Mersenne Twister in FORTRAN
-
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. (1999)
Some reported that this does not work for IBM AIX nor CRAY T3E.
- A restorable
MT19937 code in fortran 90
by
Richard Woloshyn:
"I have rewritten the fortran version of MT19937 as a module in Fortran 90.
The code, attached below, should give the same 1000 numbers as the original
code.
For some applications it is useful to be able to save the state of the
random number generator and to restart it at that point in a subsequent
run. Therefore I have added subroutines which allow the user to save and
restore the values of variables mti and mt."
-
Alan Miller wrote a
Fortran version of MT random number
generator with non-uniform distributions, see
his web site.
-
A fortran code with revrand()
: it generates prn in reverse order, coded by
Katsumi Hagita.
-
Heinrich Stamerjohanns
at Physics department, University of Oldenburg
gave a fortran code
available for IBM AIX and CRAY T3E:
mt19937_T3E.f.
"I had a little problem compiling mt19937.f for AIX, and some
bigger problems to compile mt19937.f on a CRAY T3E.
The comments on top of the attached file show the changes.
The changes for the T3E are ugly, but it seems to me
the only way to compile the function.
(the compiler issues an error saying that the parameter is
out of range if you use -MAX_INT - 1, it only accepts -MAX_INT.)"
-
A Fortran-95 code by
Josi Rui Faustino de Sousa
mt19937ar (new initialization 2002/Jan).
See
mt19937ar.f90
(a bug was found in this version.)
See enhanced and bug fixed version:
mt95.f90(2003-04-30).
-
A Fortran77 code (mt19937ar.f) by Tsuyoshi Tada.
His code is fortran77 version of mt19937ar.c.
His code is independent of size of INTERGER. This means the code can
work correctly when compiled with 8 byte INTERGER as default.
He also wrote the fortran test program (mtTest.f)
whose output is completely same as mtTest.c.
(Files mt19937ar.f and mtTest.f were broken. They have been repaired now.
2007-5-25)
Return to Versions of MT