POV-Ray : Newsgroups : povray.newusers : seed and rand : Re: seed and rand Server Time
30 Jul 2024 04:20:08 EDT (-0400)
  Re: seed and rand  
From: stephen parkinson
Date: 11 Oct 2004 02:17:18
Message: <416a256e@news.povray.org>
regdo wrote:
> Hi.
> By the documentation, I understood that the seed function initializes a
> stream of random numbers, which is independant with others.
> Obviously, it is not true :
> I have a scene in which I place objects randomly.
> In my scene I first have declarations, then positionning.
> So I have 3 seed() functions at the beginning of the code, and I use the
> third one at the end. The problem : changing the number specified in the
> seed function changes nothing. Using the debug function showed me that the
> random numbers are strictly identical whatever seed I use.
> Now if I move the seed statement and put it just before the rand function is
> used, I have something completely different.
> Conclusion : the seed/rand functions are intimately connected, and the use
> of one stream visibly "corrupts" the others.
> Can anyone tell me why I have not the same result when I put the seed in the
> beginning of the code or just before using the stream ?
> 
> 
the seed is a number to change the contents of the the random number 
sequence.
calling rand gets the next number in the sequence

hence for testing and repeatability of the sequence you use 
rand(a_number) eg rand(0) will always the same sequence of numbers

stephen


Post a reply to this message

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