Logo

Programming-Idioms

History of Idiom 69 > diff from v9 to v10

Edit summary for version 10 by :

Version 9

2015-08-20, 11:04:50

Version 10

2015-08-20, 14:35:34

Idiom #69 Seed random generator

Use seed s to initialize a random generator.

If s is constant, the generator output will be the same each time the program runs. If s is based on the current value of the system clock, the generator output will be different each time.

Idiom #69 Seed random generator

Use seed s to initialize a random generator.

If s is constant, the generator output will be the same each time the program runs. If s is based on the current value of the system clock, the generator output will be different each time.

Imports
std.random, std.stdio;
Code
auto s = 8;
auto gen = Random(s);
writeln(gen.front);