Logo

Programming-Idioms

History of Idiom 70 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-20, 16:24:47

Version 8

2015-08-20, 16:24:54

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
randGen.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