|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi all
what I need is the exact algorithm used in the POV rand() function, where
can I found this ?
thanks in advance
baillp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Thu, 5 Oct 2000 15:43:18 +0200, Pascal Baillehache wrote:
>Hi all
>what I need is the exact algorithm used in the POV rand() function, where
>can I found this ?
In the source code. Specifically, the function stream_rand() in express.c.
It's short, so I'll quote it here. Note that it isn't the best prng in the
world, and it probably fails whole truckloads of tests for randomness, but
remember that it was added almost as an afterthought to 3.0 and hasn't been
thought of much since then. Anyway, here ya go:
static DBL stream_rand(int stream)
{
next_rand[stream] = next_rand[stream] * 1812433253L + 12345L;
return((DBL)(next_rand[stream] & 0xFFFFFFFFUL) / 0xFFFFFFFFUL);
}
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights --
http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Pascal Baillehache <bai### [at] freefr> wrote:
: what I need is the exact algorithm used in the POV rand() function, where
: can I found this ?
In the povray source code perhaps?
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Many thanks,
it doesn't matter it's not the best one, I just need to compute exactly the
same one in a C++ code for a test ...
Baillp
slr### [at] fwicom...
> On Thu, 5 Oct 2000 15:43:18 +0200, Pascal Baillehache wrote:
> >Hi all
> >what I need is the exact algorithm used in the POV rand() function, where
> >can I found this ?
>
> In the source code. Specifically, the function stream_rand() in
express.c.
> It's short, so I'll quote it here. Note that it isn't the best prng in
the
> world, and it probably fails whole truckloads of tests for randomness, but
> remember that it was added almost as an afterthought to 3.0 and hasn't
been
> thought of much since then. Anyway, here ya go:
>
> static DBL stream_rand(int stream)
> {
> next_rand[stream] = next_rand[stream] * 1812433253L + 12345L;
>
> return((DBL)(next_rand[stream] & 0xFFFFFFFFUL) / 0xFFFFFFFFUL);
> }
>
>
> --
> Ron Parker http://www2.fwi.com/~parkerr/traces.html
> My opinions. Mine. Not anyone else's.
> Proudly not helping RIAA and SDMI steal my rights --
> http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|