From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
Hmm that's a good point, I was wondering about that too. Yesterday after I posted this I noticed that Dr. Matsumoto and his student Mutsuo Saito were up to their usual tricks again, and have gone and invented a new algorithm that's twice as fast.
We need to be careful in making this kind of change. LabVIEW's Random Number primitive maintains internal state so that each generator on the block diagram is independent from all others and can be executed in parallel. This means that, for example, we would want to steer away from algorithms that maintain a large state (original MT uses 624 integers).
We therefore need an algorithm that initializes quickly, is computationally efficient and deterministic in generating a new sample, uses a modest amount of state memory, and, of course, yields significantly superior random sequences.
AristosQueue: I'm sure that I'm not as familiar with the algorithms behind this as MDC is, but when I downloaded the SFMT code and took a look at the SMFT-params.h code I found this:
#if !defined(SFMT_MEXP) #if defined(__GNUC__) && !defined(__ICC) #warning "SFMT_MEXP is not defined. I assume MEXP is 19937." #endif #define SFMT_MEXP 19937 #endif /*----------------- BASIC DEFINITIONS -----------------*/ /** Mersenne Exponent. The period of the sequence * is a multiple of 2^MEXP-1. * #define SFMT_MEXP 19937 */ /** SFMT generator has an internal state array of 128-bit integers, * and N is its size. */ #define SFMT_N (SFMT_MEXP / 128 + 1) /** N32 is the size of internal state array when regarded as an array * of 32-bit integers.*/ #define SFMT_N32 (SFMT_N * 4) /** N64 is the size of internal state array when regarded as an array * of 64-bit integers.*/ #define SFMT_N64 (SFMT_N * 2)
.. which suggests that it uses 157 128-bit integers, 314 64-bit integers, or 628 32-bit integers to determine the internal state.
Interesting trivia: apparently SFMT is used on the Playstation 3.
If the size of the internal states is an issue, there is also TinyMT, which reduces the internal state size from 19937 bits to 127.
This seems to dramatically reduce the cycle length from 219937−1 down to 2127−1, but compared to the Wichmann-Hill, TinyMT would probably still improve the cycle length significantly (2.45e25 times? if it's ok to divide cycle length like that and get meaningful answers).
Sounds worth investigating. I'll add considering a change to our random algorithm to the long-term research list. I hate to call it "long-term", but there aren't many within NI who are capable of vetting this sort of fundamental algorithm change, and we move very cautiously when doing such changes -- we don't want to cause some weird break in existing user applications. I can't imagine any apps depending upon a short cycle time, for example, but I have seen some weird dependencies over the years.