SIMD-Oriented Fast Mersenne Twister: a 128-bit Pseudorandom Number Generator

  • Mutsuo Saito
  • Makoto Matsumoto


Mersenne Twister (MT) is a widely-used fast pseudorandom number generator (PRNG) with a long period of 219937 - 1, designed 10 years ago based on 32-bit operations. In this decade, CPUs for personal computers have acquired new features, such as Single Instruction Multiple Data (SIMD) operations (i.e., 128-bit operations) and multi-stage pipelines. Here we propose a 128-bit based PRNG, named SIMD-oriented Fast Mersenne Twister (SFMT), which is analogous to MT but making full use of these features. Its recursion fits pipeline processing better than MT, and it is roughly twice as fast as optimised MT using SIMD operations. Moreover, the dimension of equidistribution of SFMT is better than MT.

We also introduce a block-generation function, which fills an array of 32-bit integers in one call. It speeds up the generation by a factor of two. A speed comparison with other modern generators, such as multiplicative recursive generators, shows an advantage of SFMT. The implemented C-codes are downloadable from http ://


Function Call Single Instruction Multiple Data Pseudorandom Number Generator Linear Feedbacked Shift Register Dimension Defect 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [BZ03]
    R.P. Brent and P. Zimmermann. Random number generators with period divisible by a Mersenne prime. In Computational Science and its Applications - ICCSA 2003, volume 2667, pages 1–10, 2003.Google Scholar
  2. [BZ04]
    R.P. Brent and P. Zimmermann. Algorithms for finding almost irreducible and almost primitive trinomials. Fields Inst. Commun., 41:91–102, 2004.MathSciNetGoogle Scholar
  3. [CLT93]
    R. Couture, P. L'Ecuyer, and S. Tezuka. On the distribution of k-dimensional vectors for simple and combined Tausworthe sequences. Math. Comp., 60(202):749–761, 1993.zbMATHCrossRefMathSciNetGoogle Scholar
  4. [Fus90]
    M. Fushimi. Random number generation with the recursion x t = x t−3px t−3q. Journal of Computational and Applied Mathematics, 31:105–118, 1990.zbMATHCrossRefMathSciNetGoogle Scholar
  5. [Knu97]
    D.E. Knuth. The Art of Computer Programming. Vol. 2. Seminumerical Algorithms. Addison-Wesley, Reading, Mass., 3rd edition, 1997.Google Scholar
  6. [L'E93]
    P. L'Ecuyer. A search for good multiple recursive random number genarators. ACM Transactions on Modeling and Computer Simulation, 3(2):87–98, April 1993.zbMATHCrossRefGoogle Scholar
  7. [L'E96]
    P. L'Ecuyer. Maximally equidistributed combined tausworthe generators. Math. Comp., 65(213):203–213, 1996.zbMATHCrossRefMathSciNetGoogle Scholar
  8. [L'E99]
    P. L'Ecuyer. Tables of maximally equidistributed combined LFSR generators. Math. Comp., 68(225):261–269, 1999.zbMATHCrossRefMathSciNetGoogle Scholar
  9. [LS06]
    P. L'Ecuyer and R. Simard. TestU01: A C library for empirical testing of random number generators. ACM Transactions on Mathematical Software, 2006. to appear.Google Scholar
  10. [Mar03]
    G. Marsaglia. Xorshift RNGs. Journal of Statistical Software, 8(14):1–6, 2003.Google Scholar
  11. [MN98]
    M. Matsumoto and T. Nishimura. Mersenne twister: A 623-dimensionally equidistributed uniform pseudorandom number generator. ACM Trans. on Modeling and Computer Simulation, 8 (1):3–30, January 1998.˜m-mat/MT/emt.html. zbMATHCrossRefGoogle Scholar
  12. [MN02]
    M. Matsumoto and T. Nishimura. A nonempirical test on the weight of pseudorandom number generators. In Monte Carlo and Quasi-Monte Carlo methods 2000, pages 381–395. Springer-Verlag, 2002.Google Scholar
  13. [MN03]
    M. Matsumoto and T. Nishimura. Sum-discrepancy test on pseudorandom number generators. Mathematics and Computers in Simulation, 62 (3–6):431–442, 2003.zbMATHCrossRefMathSciNetGoogle Scholar
  14. [PL05]
    F. Panneton and P. L'Ecuyer. On the Xorshift random number generators. ACM Transactions on Modeling and Computer Simulation, 15(4):346–361, 2005.CrossRefGoogle Scholar
  15. [PLM06]
    F. Panneton, P. L'Ecuyer, and M. Matsumoto. Improved long-period generators based on linear reccurences modulo 2. ACM Transactions on Mathematical Software, 32(1):1–16, 2006.CrossRefMathSciNetGoogle Scholar
  16. [SHP+06]
    M. Saito, H. Haramoto, F. Panneton, T. Nishimura, and M. Matsumoto. Pulmonary LFSR: pseudorandom number generators with multiple feedbacks and reducible transitions. 2006. submitted.Google Scholar
  17. [SM]
    M. Saito and M. Matsumoto. SFMT Homepage.˜m-mat/MT/SFMT/index.html.
  18. [Wik]
    Endianness from Wikipedia, the free encyclopedia.

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Mutsuo Saito
    • 1
  • Makoto Matsumoto
    • 1
  1. 1.Dept. of Math.Hiroshima UniversityJapan

Personalised recommendations