Logo

Programming-Idioms

History of Idiom 69 > diff from v10 to v11

Edit summary for version 11 by :

Version 10

2015-08-20, 14:35:34

Version 11

2015-08-21, 23:34:42

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
import java.util.Random;
Imports
import java.util.Random;
Code
Random r = new Random(s);
Code
Random r = new Random(s);
Comments bubble
s is of type long.
Comments bubble
s is of type long.
Doc URL
http://docs.oracle.com/javase/8/docs/api/java/util/Random.html
Origin
http://docs.oracle.com/javase/8/docs/api/java/util/Random.html