## Is Mersenne Twister RNG available in NEURON

The basics of how to develop, test, and use models.
itaru
Posts: 14
Joined: Wed Jan 29, 2020 10:15 pm
Contact:

### Is Mersenne Twister RNG available in NEURON

I am going to do a simulation of a network of a few thousands of neurons, but to be cautious,
I'd like to use the MT RNG if available in NEURON.
itaru
Posts: 14
Joined: Wed Jan 29, 2020 10:15 pm
Contact:

### Re: Is Mersenne Twister RNG available in NEURON

I should be asking differently, what's the most reliable RNG in NEURON?
ramcdougal
Posts: 224
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

### Re: Is Mersenne Twister RNG available in NEURON

Random123 is a high-quality PRNG available from Python/HOC/NMODL in NEURON. It has the additional advantage of providing a large number of independent random streams parameterized by 3 numbers; this is extremely convenient for creating reproducible randomness that works in a parallel computing environment. (e.g. use one of the parameters to specify a stream for a given cell index, and then all the cells can be initialized independently of each other on 1 or many processors and you'll get the same results.)

The algorithm used by Random123 (one of the Philox algorithms) was introduced in the conference paper:

Salmon, J. K., Moraes, M. A., Dror, R. O., & Shaw, D. E. (2011, November). Parallel random numbers: as easy as 1, 2, 3. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (pp. 1-12). https://doi.org/10.1145/2063384.2063405

To address your initial question: Mersenne Twister is not a cryptographically secure PRNG. Only the first 624 values are free to vary independently (they are, of course, a function of the seed). After that, all the rest are 100% determined; see, e.g. https://gist.github.com/Rhomboid/b1a882c70b7a1901efa9