Compile-Time RNG
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Thu Mar 7 09:53:58 UTC 2019
On Tuesday, 5 March 2019 at 22:57:31 UTC, Stefan Koch wrote:
> it's easy. you use the time_stamp at compilation which is
> expressed as a certain lexer variable. you parse that at ctfe
> and use it as the seed for another random number gen.
Depending on the use case, that might be problematic. Consider
two different compilation units issued in the same second (so
same timestamp). Both use the CTFE RNG, and because their seed
is the same, so is the pseudo-random sequence.
More information about the Digitalmars-d
mailing list