Boost logo

Boost Users :

Subject: Re: [Boost-users] random number generators seeding with 0 and 1
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-05-05 14:35:44


AMDG

On 05/05/2012 10:04 AM, Nelis Willers wrote:
> Dear Boost Users
>
> While testing my RNG I noticed that the use of seed value 0 yields the same
> results as using a seed value of 1.
>
> It seems that this is the specified behaviour for rand() in the C runtime
> library:
> http://stackoverflow.com/questions/8049556/whats-the-difference-between-srand1-and-srand0
>
> I could find no reference to this in my (oldish) draft C++0x spec.
>
> Also no mention in the boost random doc page. I tried to unravel the
> random include files, but got lost.
>
> Is this behaviour required by the specification or just following tradition?
>
> More important, is this behaviour guaranteed in all libraries?
>

For linear_congruential_engine with c = 0, a
seed of 0 is the same as a seed of 1. Other
generators have different rules. The standard
specifies the exact seeding algorithm.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net