Logo

Programming-Idioms

History of Idiom 69 > diff from v36 to v37

Edit summary for version 37 by trueKvothe:
New Cpp implementation by user [trueKvothe]

Version 36

2019-09-27, 22:40:57

Version 37

2019-09-30, 05:53:53

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
#include <stdlib.h>
Code
srand(s);
Doc URL
http://www.cplusplus.com/reference/cstdlib/srand/