POV-Ray : Newsgroups : povray.general : Is it me or does rand(n) loop ? : Re: Is it me or does rand(n) loop ? Server Time
5 Aug 2024 02:23:07 EDT (-0400)
  Re: Is it me or does rand(n) loop ?  
From: Patrick Elliott
Date: 18 Dec 2002 15:52:06
Message: <MPG.186a8b782f281e449896e9@news.povray.org>
In article <3e00c13f@news.povray.org>, tho### [at] trfde says...
> In article <web.3e00a576fc9687d9f765b2b40@news.povray.org> , "BlackRose" 
> <nomail@nomail> wrote:
> 
> > Anyways, it seemed that no matter what bounds I used, I was getting square
> > grids of objects (instead of the randomly placed ones I wanted). Upon
> > debugging, I found that (atleast to 5 decimal places) the values popped out
> > by a particular rand stream repeated (which is not what I had expected.
> > BTW, I'm doing this on a winXP machine, with pov version 3.5...
> >
> > Any suggestions on how to get 'round this ? Anyone else come across this
> > before ? I guess I could create new random number streams, but I don't know
> 
> What you are seeing cannot be avoided with pure digital logic.  Thus there
> is no way around it using pure digital logic; the "random" numbers will
> always have a certain bias, no matter how you create them.  You can only
> make them more or less close to "perfect" random numbers.  Search Google for
> "random number generator" and you will get many links to almost as many
> different (pseudo) random number generators.
> 
>     Thorsten
> 
Yes. Most that try to fix this use something like:

a = seed(now)

The idea being to use the current system clock time to reseed the 
generator each time. Not sure if POV has such a thing...

This can be sort of fun though if something is wrong with the system 
clock. Years ago I tried to run a dice rolling program (I.e. roll two 
dice, add them up and display what % all combos came up) on an Apple II 
who power supply turned out to be failing. When I brought it to the 
attention of the teacher he asked if I was using shaved dice. lol


Post a reply to this message

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