PHYSICS 142/242
Spring 2009
Laboratory 4
I. Quantum Monte Carlo Method
Quantum Monte Carlo and Harmonic Oscillator (PDF Document)
Java Applet web page showing the live simulation
II. On Random Numbers:
Mersenne Twister
(Best random number generator in the Universe)
Period 2**19937-1
Caution: MT is for MonteCarlo,
and is NOT SECURE for CRYPTOGRAPHY as is.
See the following
Frequently Asked Question.
What is Mersenne Twister?
Mersenne Twister(MT) is a pseudorandom number generator
developed by Makoto Matsumoto and Takuji Nishimura
during 1996-1997.
MT has the following merits:
- It is designed with consideration on the flaws
of various existing generators.
- The algorithm is coded into a C source downloadable below.
- Far longer period and far higher order of equidistribution
than any other implemented generators.
(It is proved that the period is 2^19937-1,
and 623-dimensional equidistribution property is assured.)
- Fast generation.
(Although it depends on the system, it is reported that
MT is sometimes faster than the standard ANSI-C library
in a system with pipeline and cache memory.)
- Efficient use of the memory.
(The implemented C-code mt19937.c consumes only 624 words
of working area.)
The scientific paper on MT
is below.
- mt.ps.gz M. Matsumoto and T. Nishimura,
"Mersenne Twister: A 623-dimensionally equidistributed uniform
pseudorandom number generator", ACM Trans. on Modeling and Computer
Simulation Vol. 8, No. 1, Januray pp.3-30 1998
C codes
The implemented C-code([0,1]-interval
mt19937.c )
Unsigned 32-bit integer version
mt19937int.c
Standard MT codes and outputs, 99/10/29 version
(initialization modified)
click here ('99/10/29)
FORTRAN codes
Hiroshi Takano at Department of Physics at
Keio Univ. kindly wrote Fortran versions:
mt19937.f for real
mt19937int.f for integer.
These codes yielded the same output as C-code in
f77 and f90 on HP-UX 10.20,
g77 on SunOS 4.1.4, and
f77 on NEWS-OS 4.2.1R, but yet to be tested.