|
|
"awestover" <nomail@nomail> wrote:
> 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?
Yes, because you are reinitiating the seed with each iteration.
#declare test = 0;
#declare RSEED=seed(76549);
#while(test < 50000)
#debug concat(" ",str(rand(RSEED),1,5))
#declare test = test + 1;
#end
-tgq
Post a reply to this message
|
|