1. Random Seed
- Posted by Michael Bolin <lucretius_2 at yahoo.com> Mar 07, 2005
- 497 views
It's probably too late to make any changes in 2.5, but for future reference: There seems to be a discrepancy between running standard source and bound files, with regard to the initial random seed. The following code:
for t=1 to 10 do ?rand(5) end for
produces a different sequence of numbers each time it is run as source (with EX; I haven't tried EXW); but when bound the sequence is always the same. I take this to mean that the initial seed for the random number function is fixed for the bound file. I don't know which way was intended, but the source method seems preferable-- if you want a predictable random sequence you can just use set_rand(). -- Michael Bolin
2. Re: Random Seed
- Posted by Robert Craig <rds at rapideuphoria.com> Mar 07, 2005
- 474 views
Michael Bolin wrote: > > It's probably too late to make any changes in 2.5, but for future reference: > > There seems to be a discrepancy between running standard source > and bound files, with regard to the initial random seed. The following code: > > }}} <eucode> > for t=1 to 10 do > ?rand(5) > end for > </eucode> {{{ > > produces a different sequence of numbers each time it is run as > source (with EX; I haven't tried EXW); but when bound the sequence > is always the same. I take this to mean that the initial seed for > the random number function is fixed for the bound file. I don't > know which way was intended, but the source method seems preferable-- > if you want a predictable random sequence you can just use set_rand(). It is getting late, but I think I better investigate and fix this. Euphoria is supposed to start you off with a new random sequence each time. Thanks for reporting it. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com