SEED [JAVA | MERSENNE] [literalInteger]

Selects the algorithm that generates the pseudo-random numbers and/or sets the seed used by the random number generator. If you set the seed at the beginning of your program, then each time you run your program you will get exactly the same answer. That's because for a given seed, the random number generator will repeat the same sequence of "random" numbers.

Statistics101 provides two algorithms for generating random numbers. The default algorithm is called the Mersenne Twister algorithm. It is supposed to be better (more "random") than Java's built-in generator and also able to generate many many millions (2**19937 – 1) of numbers before repeating. The Mersenne Twister algorithm is considered to be the best pseudo-random number generator available for stochastic simulation. The specific Java implementation of the Mersenne Twister used here is

The other random generator option is the algorithm provided by Java's built-in java.util.Random class. See the examples at right to see how to select one or the other of the two algorithms.

If you don't use the SEED command, which is the normal case, then the MersenneTwisterFast algorithm will be used and the seed will be automatically chosen based on your computer's clock. So every time you run a program it will be fed by a different sequence of random numbers.

When you first startup the Statistics101 program, it will default to using the MersenneTwisterFast algorithm with a seed chosen based on the system clock. If you wish, you can change the default to Java's algorithm in the Edit Preferences dialog box, although that is not recommended.

As long as that instance of the Statistics101 program is running, it will continue to use whatever algorithm was last selected (or defaulted) until you command it to change using the SEED command.

SEED java 12345
NORMAL 5 50 10 B

Two consecutive runs of the above program produced this:

B: (48.12191010341088 55.88436305115479 
   59.48804780440042 45.05719279373955 
B: (48.12191010341088 55.88436305115479 
   59.48804780440042 45.05719279373955 

Note that the results are identical because the same seed was used for both runs.

You can force the use of one of the generators with the SEED command letting the system select the seed with a command like the following, which forces the use of the mersenne generator for all subsequent random numbers (if it's already using mersenne, this command will have no effect):

SEED mersenne


SEED java

You can force the use of one of the generators and simultaneously set the seed like this:

SEED mersenne 8574

You can set the seed of whatever generator is currently running with a command like this one:

SEED 2314