Warp wrote:
> Tom Melly <tom### [at] tomandlu co uk> wrote:
>> Once I'd worked out what the code did, the same thought occured - is
>> there something in the way the stream is generated that makes that
>> impossible? For example, that a particular number is always followed by
>> another fixed number?
>
<snip>
> As I don't have any idea what kind of algorithm pov's generator uses,
> I can't say how it works there. Very simple generators start repeating
> over immediately when the same number which has appeared before appears
> again.
>
I found following in POV's express.cpp
static DBL stream_rand(int stream)
{
next_rand[stream] = next_rand[stream] * 1812433253L + 12345L;
return((DBL)(next_rand[stream] & 0xFFFFFFFFUL) / 0xFFFFFFFFUL);
}
An iterated random generator like this obiously cannot have a longer period
than 2^sizeof(int).
- Micha
--
POV-Ray Objects Collection: http://objects.povworld.org
Post a reply to this message
|