POV-Ray : Newsgroups : povray.binaries.images : Toward a less-lame rand() function. : Re: Toward a less-lame rand() function. Server Time
1 Aug 2024 00:19:44 EDT (-0400)
  Re: Toward a less-lame rand() function.  
From: Darren New
Date: 20 May 2009 10:48:26
Message: <4a14183a$1@news.povray.org>
Kenneth wrote:
> If my simplistic assumptions/understandings are correct, then it seems to me
> that it all still begs the question of why there are repetitive patterns when
> using seed(frame_number) in animations

Think of it this way: each number resulting from seed(n) is related to the 
number from seed(n+1) in a fairly simple way. However, calling rand() three 
times gives you rand(rand(rand(seed(n)))). In other words, the seed starts 
you, but the rand() call uses the result of the previous rand() call as the 
next seed. *That* is where the more complex randomness comes from.

This only applies to the LCG type PRNG that POV uses, btw. This isn't true 
of all RNGs.  It *is* true of many cryptographic systems, but they have far 
more complex RNGs to start with, also.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.