How to generate a random number from system clock as seed

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Jun 9 13:20:09 UTC 2024


On Saturday, 8 June 2024 at 16:09:04 UTC, monkyyy wrote:
> rng is an optional parameter, `uniform(0,100).writeln;` alone 
> works; the docs not telling you that is really bad

The docs do tell you that `rng` is an optional parameter of 
`uniform`:
https://dlang.org/phobos/std_random.html#uniform

However, there are often good reasons to want to pass a specific 
RNG: you may want to pick the specific RNG algorithm, and you may 
want to be able to know exactly how it was seeded, e.g. if you 
want to be able to reproduce the same results.  I assume that 
Eric's use case may reflect that.


More information about the Digitalmars-d-learn mailing list