skip to main content
article
Free Access

Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator

Published:01 January 1998Publication History
Skip Abstract Section

Abstract

A new algorithm called Mersenne Twister (MT) is proposed for generating uniform pseudorandom numbers. For a particular choice of parameters, the algorithm provides a super astronomical period of 219937 −1 and 623-dimensional equidistribution up to 32-bit accuracy, while using a working area of only 624 words. This is a new variant of the previously proposed generators, TGFSR, modified so as to admit a Mersenne-prime period. The characteristic polynomial has many terms. The distribution up to v bits accuracy for 1 ≤ v ≤ 32 is also shown to be good. An algorithm is also given that checks the primitivity of the characteristic polynomial of MT with computational complexity O(p2) where p is the degree of the polynomial.

We implemented this generator in portable C-code. It passed several stringent statistical tests, including diehard. Its speed is comparable to other modern generators. Its merits are due to the efficient algorithms that are unique to polynomial calculations over the two-element field.

References

  1. BRILLHART, J., LEHMER, D. H., SELFRIDGE, J. L., TUCKERMAN, B., AND WAGSTAFF, S. S., JR. 1988. Factorizations of bn _ 1. 2nd ed., Vol. 22, Contemporary Mathematics. AMS, Providence, R.I.Google ScholarGoogle Scholar
  2. The hierarchy of correlations in random binary sequences. J. Stat. Phys. 63, 883-896.Google ScholarGoogle Scholar
  3. COUTURE, R., L'ECUYER, P., AND TEZUKA, S. 1993. On the distribution of k-dimensional vectors for simple and combined Tausworthe sequences. Math. Comput. 60, 749-761.Google ScholarGoogle Scholar
  4. FERRENBERG, A. M., LANDAU, D. P., AND WONG, Y.J. 1992. Monte Carlo simulations: hidden errors from "good" random number generators. Phys. Rev. Lett. 69, 3382-3384.Google ScholarGoogle ScholarCross RefCross Ref
  5. FREDRICSSON, S.A. 1975. Pseudo-randomness properties of binary shift register sequences. IEEE Trans. Inf. Theor. 21, 115-120.Google ScholarGoogle ScholarCross RefCross Ref
  6. FUSHIMI, M. 1990. Random number generation with the recursion xt - xt_3p ~ xt_3q. J. Comput. Appl. Math. 31, 105-118. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. FUSHIMI, M. AND TEZUKA, S. 1983. The k-distribution of generalized feedback shift register pseudorandom numbers. Commun. ACM 4, 516-523. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. HELLEKALEK, P. 1997. Good random number generators are (not so) easy to find. In Proceedings of the Second IMACS Symposium on Mathematical Modeling (Vienna). Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. HELLEKALEK, P., AUER, T., ENTACHER, K., LEEB, H., LENDL, O., AND WEGENKITTL, S. The PLAB www-server, http://random.mat.sbg.ac.at. Also accessible via ftp.Google ScholarGoogle Scholar
  10. HERINGA, J. R., BLOTE, H. W. J., AND COMPAGNER, A. 1992. New primitive trinomials of Mersenne-exponent degrees for random-number generation. Int. J. Modern Phys. C3, 561-564.Google ScholarGoogle ScholarCross RefCross Ref
  11. KNUTH, D. E. 1981. Seminumerical Algorithms. 2nd ed., Vol. 2, The Art of Computer Programming. Addison Wesley, Reading, MA.Google ScholarGoogle Scholar
  12. KNUTH, D.E. 1996. Private communication. Keio Univ., Nov. 1996; Jan. 7th 1997.Google ScholarGoogle Scholar
  13. KNUTH, D. E. 1997. Seminumerical Algorithms. 3rd ed., Vol. 2, The Art of Computer Programming. Addison Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. L'ECUYER, P. 1994. Uniform random number generation. Ann. Oper. Res. 53, 77-120.Google ScholarGoogle ScholarCross RefCross Ref
  15. L'ECUYER, P. 1996. Maximally equidistributed combined Tausworthe generators. Math. Comput. 65, 203-213. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. LENSTRA, A.K. 1985. Factoring multivariate polynomials over finite fields. J. Comput. Syst. Sci. 30, 235-248.Google ScholarGoogle ScholarCross RefCross Ref
  17. LENSTRA, A. K., LENSTRA, H. W., JR., AND Lovhsz, L. 1982. Factoring polynomials with rational coefficients. Math. Ann. 261, 515-534.Google ScholarGoogle ScholarCross RefCross Ref
  18. LEWIS, T. G. AND PAYNE, W. H. 1973. Generalized feedback shift register pseudorandom number algorithms. J. ACM 20, 456-468. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. LINDHOLM, J.H. 1968. An analysis of the pseudo-randomness properties of subsequences of long m-sequences. IEEE Trans. Inf. Theor. 14, 569-576.Google ScholarGoogle ScholarCross RefCross Ref
  20. MARSAGLIA, a. 1985. A current view of random numbers. In Computer Science and Statistics, Proceedings of the Sixteenth Symposium on The Interface, North-Holland, Amsterdam, 3-10.Google ScholarGoogle Scholar
  21. MARSAGLIA, G. AND ZAMAN, A. 1991. A new class of random number generators. Ann. Appl. Probab. 1, 462-480.Google ScholarGoogle ScholarCross RefCross Ref
  22. MATSUMOTO, M. AND KURITA, Y. 1992. Twisted GFSR generators. ACM Trans. Model. Comput. Simul. 2, 179-194. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. MATSUMOTO, M. AND KURITA, Y. 1994. Twisted GFSR generators II. ACM Trans. Model. Comput. Simul. 4, 254-266. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. MATSUMOTO, M. AND KURITA, Y. 1996. Strong deviations from randomness in m-sequences based on trinomials. ACM Trans. Model. Comput. Simul. 6, 99-106. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. NIEDERREITER, H. 1993. Factorization of polynomials and some linear-algebra problems over finite fields. Linear Algebra Appl. 192, 301-328.Google ScholarGoogle ScholarCross RefCross Ref
  26. NIEDERREITER, H. 1995. The multiple-recursive matrix method for pseudorandom number generation. Finite Fields Appl. 1, 3-30. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. RUEPPEL, R.A. 1986. Analysis and Design of Stream Ciphers. Communication and Control Engineering Series. Springer-Verlag, New York, NY. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. TEZUKA, S. 1990. Lattice structure of pseudorandom sequences from shift register generators. In Proceedings of the 1990 Winter Simulation Conference R. E. Nance Ed. IEEE, 266 -269. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. TEZUKA, S. 1994a. The k-dimensional distribution of combined GFSR sequences. Math. Comput. 62, 809-817. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. TEZUKA, S. 1994b. A unified view of long-period random number generators. J. Oper. Res. Soc. Japan 37, 211-227.Google ScholarGoogle Scholar
  31. TEZUKA, S. 1995. Uniform Random Numbers: Theory and Practice. Kluwer.Google ScholarGoogle Scholar
  32. TEZUKA, S. AND L'ECUYER, P. 1991. Efficient and portable combined Tausworthe random number generators. ACM Trans. Model. Comput. Simul. 1, 99-112. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. TEZUKA, S., L'ECUYER, P., AND COUTURE, R. 1993. On the lattice structure of the add-withcarry and subtract-with-borrow random number generators. ACM Trans. Model. Comput. Simul. 3, 315-331. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. TOOTILL, J. P. R., ROBINSON, W. D., AND EAGLE, D. J. 1973. An asymptotically random Tausworthe sequence. J. ACM 20, 3, 469-481. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader