# What pseudo-random number generators are available to Mathematica users?

One would think I should be able answer the question I pose in the title for myself by reading the Documentation Center article ref/SeedRandom, but it's not so simple.

That article does give a list of generators, namely

• "Congruential", "ExtendedCA", 'Legacy", "MersenneTwister", "MKL", "Rule30CA"

### Generators offered by the auto-completion system

One, of course, tells Mathematica which pseudo-random number generator to use by giving the Method option to SeedRandom. If I avail myself of the auto-completion facility, I can get the following four completions for the Method option of SeedRandom. I tried all of them.

SeedRandom[Method -> "MersenneTwister"]; (* works *)
SeedRandom[Method -> {"Sobol", "Dimension" -> 2}]; (* does not work *)
SeedRandom[Method -> {"MKL", Method -> "MCG59"}]; (* works *)
SeedRandom[Method -> {"Niederreiter", "Dimension" -> 2}]; (* does not work *)


I believe the two completions that don't work indicate a bug in the files supporting the auto-completion algorithm, but that's not the issue here. What's relevant here is the generator, {"MKL", Method -> "MCG59"}. Is this generator in any way distinct from "MKL"?

### Generators suggested by SeedRandom::nogen

A SeedRandom call specifying an invalid generator method emits the message SeedRandom::nogen which offers the user a helpful list of valid generators, namely

• "ParallelGenerator", "Lattice", "Congruential", "ParallelMersenneTwister", "MersenneTwister", "MKL", "Rule30CA", "Rule50025CA', "ExtendedCA", "Legacy"

This list contains generators not offered by auto-completion and even some not mentioned in the Documentation Center articles ref/SeedRandom and tutorial/RandomNumberGeneration. It even mentions some not mentioned in the answers to a related question.

### Are there more?

I'm left wondering if there are still more pseudo-random number generators than the ones I uncovered during my little adventure with the Method option of SeedRandom.

• here – ciao Sep 26 '15 at 5:59
• @ciao. Nice reference. Adds a goodly amount of supporting material, but does not answer my question. – m_goldberg Sep 26 '15 at 6:04
• Am I missing something? Isn't "... wondering if there are still more pseudo-random number generators..." the question? – ciao Sep 26 '15 at 6:14
• @ciao. I've read the article you cite. It doesn't contain a complete list of the built-in generators. For example, it doesn't mention "Lattice", so why should I consider it definitive? – m_goldberg Sep 26 '15 at 6:26
• Fair enough, removing CV – ciao Sep 26 '15 at 6:40

No, there are no more built-in generators.

In this case, the SeedRandom::nogen message can be regarded as definitive. The list it prints is not predefined, but a runtime enumeration of all existing system random number generators.

A couple of these are indeed undocumented: "Rule50025CA" is cellular automaton based and similar to "ExtendedCA" but using a different rule; "Lattice" is intended for internal use by NIntegrate's "MonteCarloRule" for generating lattice random points (it is not the default as far as I know, but can be requested via the "PointGenerator" suboption).

The code completion mix-up of methods and method suboptions is a bug; it could also offer completions for the other documented methods, not just "MKL" and "MersenneTwister". I will follow-up on this so it can be fixed (update: fixed in 10.4.0).

For the remaining question,

What's relevant here is the generator, {"MKL", Method -> "MCG59"}. Is this generator in any way distinct from "MKL"?

MCG59 is one of several different generators implemented in the Intel MKL library. This setting is distinct from using just "MKL" which defaults to MRG32k3a.

• Judging from the name I would have guessed that "Lattice" is used in "QuasiMonteCarlo". But I have not looked at the code and that's just a guess. – Daniel Lichtblau Sep 27 '15 at 16:25