POV-Ray : Newsgroups : povray.general : seed/rand not so random? : seed/rand not so random? Server Time
29 Jul 2024 22:24:30 EDT (-0400)
  seed/rand not so random?  
From: stevenvh
Date: 12 May 2010 12:05:00
Message: <web.4bead0a92aa23770c0721a1d0@news.povray.org>
I'm shocked! :-)

I'm using the animation function to generate a series of images of my scene,
where the camera position is chosen at random, using the frame number as seed.

Rnd1 = seed( frame_number )
CamX = rand(Rnd1)
CamY = rand(Rnd1)
CamZ = rand(Rnd1)

I noticed that the second random number (CamY) follows a rather clean linear
function of the seed, from 0 to 1 and then returning to 0, thus resulting in a
"sawtooth" function. So I got curious: do other random numbers follow such a not
quite random pattern. Well, yes, they do. I tried the 101st number and it shows
the same sawtooth function.
This is a rather unpleasant surprise. Shouldn't we expect random numbers to have
no direct relation with the previous number (or seed)?

Without having done a statistical analysis consecutive random values seem to
behave better. So it looks like there's just the relationship with the seed
value.
Time for a new seed function (seed2?) ?

Steven


Post a reply to this message

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