What is the maximum number of random real number generated by Mersenne Twister?

4 views (last 30 days)
We know that the period of Mersenne Twister is 2^19937 -1. I want to know what is the max random real number that can be generated in Matlab 32 bits and 64 bits?

Answers (1)

Walter Roberson
Walter Roberson on 13 Jun 2016
The possible output values are (1 : 2^53 - 1) / 2^53 which is 2^53 - 2 distinct values. Most of the random number generators are the same (but a few are different.)
  8 Comments
Jay Liu
Jay Liu on 13 Jun 2016
Thanks again. If my accuracy is > 5E-10, 32 bits generator is no longer available. Then, The only way in Matlab is to choose 64 bits generator such as Multiplicative Lagged Fibonacci. Is it correct?
LeChat
LeChat on 21 Apr 2020
I would like to compare some results I have from a code in c that uses the Mesenne twister on 64 bits (mt19937-64.c) with the Matlab code that I wrote (the idea is to use the same rng seed and the same rng and check if the results are exactly the same, at least to numerical precision). Unfortunately the Mersenne RNG is on 32 bits on Matlab. What would be the syntax for a workaround? (should I put this as an independent question? I guess it pretty much the same as Jay's though...)

Sign in to comment.

Categories

Find more on Random Number Generation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!