|
Boost : |
Subject: Re: [boost] [random] seeding with arbitrary integers
From: John Maddock (john_at_[hidden])
Date: 2009-10-22 04:44:23
> seed will work as advertised. Regardless of the outcome
> of this discussion, I will make sure that the exact behavior
> is documented.
I think that's the key here: if the documentation clearly states that the
seed is treated modulo N or whatever then that would be OK for me.
Whatever the status quo is unacceptable given that seeding with unspecified
values (from time() or some other non-deterministic device) is so
commonplace. Throwing an exception for out-of-range values might work, but
as pointed out the exception would occur so infrequently in practice that
your just creating another source of bugs.
Robert, what if the docs clearly stated that "Safe values for the seed are
0-N, values outside this range get wrapped within it via modulo N
arithmetic, therefore different seeds can result in the same sequence of
random values if one of those seeds is outside of the safe range." Or
something like that ;-)
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk