Mersenne Twister 64bit version

Japanese Version

Here is a C code of Mersenne Twister for 64 bit machines, mt19937-64.c , with period 2^19937-1. And its output mt19937-64.out.txt.

The recursion is similar but different, so the output is totally different from the 32-bit versions.

Here is an archive file mt19937-64.tgz and mt19937-64stdint.tgz. In mt19937-64stdint.tgz 64-bit unsigned integer is declared as uint64_t and 64-bit unsigned immediate value is declared using UINT64_C. It includes header file mt64.h and test main function file mt19937-64test.c. The file mt19937.c in this archive does not have main function. The archive has files listed below.

(2007/2/8) Adam Ierymenko informed us of a very simple speed up: see here.

(2008/12/4) Change the argument definition of init_by_array to obey ANSI standard.

Mersenne Twister Home Page

If you want a twice to four times faster variant of MT, there is one designed for SIMD CPUs. It is faster than the original MT, even in non-SIMD CPUs, and has better assurance of randomenss. It also supports 64-bit output. Downloadable from "SIMD-oriented Fast Mersenne Twister (SFMT)".