SIMD-Oriented Fast Mersenne Twister: a 128-bit Pseudorandom Number Generator
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.
KeywordsFunction Call Single Instruction Multiple Data Pseudorandom Number Generator Linear Feedbacked Shift Register Dimension Defect
Unable to display preview. Download preview PDF.
- [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
- [Knu97]D.E. Knuth. The Art of Computer Programming. Vol. 2. Seminumerical Algorithms. Addison-Wesley, Reading, Mass., 3rd edition, 1997.Google Scholar
- [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
- [Mar03]G. Marsaglia. Xorshift RNGs. Journal of Statistical Software, 8(14):1–6, 2003.Google Scholar
- [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
- [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
- [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
- [SM]M. Saito and M. Matsumoto. SFMT Homepage. http://www.math.sci.hiroshima-u.ac.jp/˜m-mat/MT/SFMT/index.html.
- [Wik]Endianness from Wikipedia, the free encyclopedia. http://en.wikipedia.org/wiki/Endianness.