1. Random Seed

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

new topic     » topic index » view message » categorize

2. Re: Random Seed

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu