Posted by davie on 12/04/25 11:57
geoffp wrote:
> I need to generate reproducible random number series.
>
> I've done the obvious - use mt_srand with the same seed. This supposedly
> will create the same series every time.
>
> Is this true? Its not working for me.
>
> By the way, seeding mt_srand with different integers doesn't necessarily
> produce different series. I've done a little testing and every pair of
> consecutive even and odd numbers produces the same series. eg. seed 0 and 1
> produce the same series, as does 10000 and 10001.
>
> geoffair in xgmailx xcomx
As of PHP 4.2.0, there is no need to seed the random number generator
with srand() or mt_srand() as this is now done automatically.
I assume you want the same series of random numbers ?
If this is the case generate your series and save to a file
Navigation:
[Reply to this message]
|