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

  • Mutsuo Saito
  • Makoto Matsumoto

Summary

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 ://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  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.MATHCrossRefMathSciNetGoogle 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.MATHCrossRefMathSciNetGoogle 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.MATHCrossRefGoogle Scholar
  7. [L'E96]
    P. L'Ecuyer. Maximally equidistributed combined tausworthe generators. Math. Comp., 65(213):203–213, 1996.MATHCrossRefMathSciNetGoogle Scholar
  8. [L'E99]
    P. L'Ecuyer. Tables of maximally equidistributed combined LFSR generators. Math. Comp., 68(225):261–269, 1999.MATHCrossRefMathSciNetGoogle 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. http://www.math.sci.hiroshima-u.ac.jp/˜m-mat/MT/emt.html. MATHCrossRefGoogle 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.MATHCrossRefMathSciNetGoogle 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. http://www.math.sci.hiroshima-u.ac.jp/˜m-mat/MT/SFMT/index.html.
  18. [Wik]
    Endianness from Wikipedia, the free encyclopedia. http://en.wikipedia.org/wiki/Endianness.

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