Logo

Programming-Idioms

History of Idiom 70 > diff from v12 to v13

Edit summary for version 13 by :

Version 12

2015-09-05, 07:42:17

Version 13

2015-10-29, 14:05:15

Idiom #70 Use clock as random generator seed

Get the current date and provide it as a seed to a random generator. The generator sequence will be different at each run.

Idiom #70 Use clock as random generator seed

Get the current date and provide it as a seed to a random generator. The generator sequence will be different at each run.

Imports
import std.datetime, std.random;
Imports
import std.datetime, std.random;
Code
rndGen.seed(cast(uint)Clock.currTime.stdTime);
Code
rndGen.seed(cast(uint)Clock.currTime.stdTime);
Comments bubble
reseed the default thread-local random number generator
Comments bubble
reseed the default thread-local random number generator