POV-Ray : Newsgroups : povray.newusers : Need rand() help : Re: Need rand() help Server Time
29 Jul 2024 02:31:42 EDT (-0400)
  Re: Need rand() help  
From: George J  Wallace
Date: 9 Jan 2007 09:48:14
Message: <45a3ab2e$1@news.povray.org>
Thank you Very Much.  I was trying to use the value in rand() like a
subscript and it kept spitting up.  Thanks again for the explanation...gjw
"Slime" <fak### [at] emailaddress> wrote in message
news:45a31c20$1@news.povray.org...
> > Thanks for the fast reply.  Is the value plugged into the rand()
statement
> > actually a subscript to a value in the random number stream?  If yes,
then
> > how long is the random number stream (how many times can I tap into the
> same
> > stream)? TIA, again...gjw
>
>
> Think of colorSeed as a list of random numbers, and rand(colorSeed) always
> gets the next one. If you want to start over, you just #declare colorSeed
> again in the same way. My guess is that the stream is about 2^32 numbers
> long, which is long enough that you'll never hit the end of it (and if you
> do it will just loop back to the beginning).
>
> The only reason to have the "seed" in the first place is so that you can
> have different streams of random numbers. So if you write code that
> generates 100 random colors, and you like the randomness you're getting,
but
> in the same loop you want to generate 100 random positions, you can use a
> different seed (like positionSeed or something) and it won't change the
> colors that are generated.
>
>  - Slime
>  [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

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