readme-mt.txt 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. This is a Mersenne Twister pseudorandom number generator
  2. with period 2^19937-1 with improved initialization scheme,
  3. modified on 2002/1/26 by Takuji Nishimura and Makoto Matsumoto.
  4. modified on 2005/4/26 by Mutsuo Saito
  5. Contents of this tar ball:
  6. readme-mt.txt this file
  7. mt19937ar.c the C source (ar: initialize by ARray)
  8. mt19937ar.h the C header file for mt19937ar
  9. mtTest.c the C test main program of mt19937ar.c
  10. mt19937ar.out Test outputs of six types generators. 1000 for each
  11. 1. Initialization
  12. The initialization scheme for the previous versions of MT
  13. (e.g. 1999/10/28 version or earlier) has a tiny problem, that
  14. the most significant bits of the seed is not well reflected
  15. to the state vector of MT.
  16. This version (2002/1/26) has two initialization schemes:
  17. init_genrand(seed) and init_by_array(init_key, key_length).
  18. init_genrand(seed) initializes the state vector by using
  19. one unsigned 32-bit integer "seed", which may be zero.
  20. init_by_array(init_key, key_length) initializes the state vector
  21. by using an array init_key[] of unsigned 32-bit integers
  22. of length key_kength. If key_length is smaller than 624,
  23. then each array of 32-bit integers gives distinct initial
  24. state vector. This is useful if you want a larger seed space
  25. than 32-bit word.
  26. 2. Generation
  27. After initialization, the following type of pseudorandom numbers
  28. are available.
  29. genrand_int32() generates unsigned 32-bit integers.
  30. genrand_int31() generates unsigned 31-bit integers.
  31. genrand_real1() generates uniform real in [0,1] (32-bit resolution).
  32. genrand_real2() generates uniform real in [0,1) (32-bit resolution).
  33. genrand_real3() generates uniform real in (0,1) (32-bit resolution).
  34. genrand_res53() generates uniform real in [0,1) with 53-bit resolution.
  35. Note: the last five functions call the first one.
  36. if you need more speed for these five functions, you may
  37. suppress the function call by copying genrand_int32() and
  38. replacing the last return(), following to these five functions.
  39. 3. main()
  40. main() is an example to initialize with an array of length 4,
  41. then 1000 outputs of unsigned 32-bit integers,
  42. then 1000 outputs of real [0,1) numbers.
  43. 4. The outputs
  44. The output of the mt19937ar.c is in the file mt19937ar.out.
  45. If you revise or translate the code, check the output
  46. by using this file.
  47. 5. Cryptography
  48. This generator is not cryptoraphically secure.
  49. You need to use a one-way (or hash) function to obtain
  50. a secure random sequence.
  51. 6. Correspondence
  52. See:
  53. URL http://www.math.keio.ac.jp/matumoto/emt.html
  54. email matumoto@math.keio.ac.jp, nisimura@sci.kj.yamagata-u.ac.jp
  55. 7. Reference
  56. M. Matsumoto and T. Nishimura,
  57. "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform
  58. Pseudo-Random Number Generator",
  59. ACM Transactions on Modeling and Computer Simulation,
  60. Vol. 8, No. 1, January 1998, pp 3--30.
  61. -------
  62. Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
  63. All rights reserved.
  64. Copyright (C) 2005, Mutsuo Saito
  65. All rights reserved.