POV-Ray : Newsgroups : povray.programming : Random number generator not random : Random number generator not random Server Time
19 Apr 2024 05:58:12 EDT (-0400)
  Random number generator not random  
From: awestover
Date: 29 Apr 2011 23:30:00
Message: <web.4dbb81b1b94add89f3a3c0f50@news.povray.org>
I was playing with the random number generator and noticed that the number was
always the same. Some sample code I was using to test was:

#declare test = 0;
#while(test < 50000)
    #debug concat(" ",str(rand(seed(76549)),1,5))
    #declare test = test + 1;
#end

Every single time I ran this the only value for all 50000 runs was .91258. I
could run it with rand(seed(test)) and get different values but for my program
as a whole that doesn't seem to be a real option. I understand that the seed
means that every time you run the program the numbers will appear in the same
order, but I thought that calling rand() with the same seed multiple times would
yield different results. Am I missing something?


Post a reply to this message

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