Page **1** of **1**

### Is Mersenne Twister RNG available in NEURON

Posted: **Tue Mar 17, 2020 9:35 pm**

by **itaru**

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.

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

Posted: **Wed Mar 18, 2020 1:55 am**

by **itaru**

I should be asking differently, what's the most reliable RNG in NEURON?

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

Posted: **Wed Mar 18, 2020 10:12 am**

by **ramcdougal**

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