User:Super mersenne/sandbox
The 64-bit Maximally Equidistributed F2-Linear Generator with Mersenne Prime Period (MELG-64) is a family of 64-bit Mersenne-Twister-type pseudorandom number generators developed by Shin Harase and Takamitsu Kimoto between 2014 and 2017, and the corresponding paper was published on ACM TOMS in 2018[1]. MELG-64 has 64-bit very long period based on linear recurrences over the two-element field F2={0, 1} and is completely optimized in terms of the equidistribution properties with similar speed as 64-bit Mersenne Twisters.
Background
[edit]The 32-bit Mersenne Twister (MT) MT19937 is one of the most widely used pseudorandom number generator|pseudorandom number generators (PRNGs), but it is not completely optimized in terms of high-dimensional uniformity, which is a theoretical criterion of PRNGs. The 32-bit WELL generators was developed in order to overcome this weakness. As 64-bit PRNGs, MT19937-64 and SFMT19937 using SIMD were proposed, but there had existed no 64-bit MT-type PRNG completely optimized for high-dimensional uniformity.
Feature
[edit]- Fast generation competitive with 64-bit Mersenne Twisters.
- Very long period 219937-1 ≈ 106000.
- This is the same period as widely used Mersenne Twisters.
- Memory size requiring only 312 words (similarly to 64-bit Mersenne Twisters).
- In accordance with memory size, implementations with various period lengths from 2607-1 to 244497-1 are provided.
- High-dimensional uniformity completely optimized.
- This property is one of the most informative criterion for high dimensional uniformity of PRNGs.
- In the case of 32-bit PRNGs, WELL generators were known, but 64-bit counterparts had not been developed.
- The non-zero coefficients of the characteristic polynomials drastically increased.
- Approximately half of the coefficients of the characteristic polynomials are nonzero, and hence it is expected that MELG-64 recovers from 0-excess states very quickly[2].
- The algorithm based on linear recurrence over the two-element field F2 and designed via several theoretical criteria.
- The jump-ahead algorithm implemented in order to obtain disjoint streams in parallel computing. (The default skip size is 2256.)
High-dimensional uniformity
[edit]

The high-dimensional uniformity is a theoretical criterion for PRNGs[4][5], which is assessed via the dimension of equidistribution with v-bit accuracy as follows.
Let
- x0, x1, ..., xP-1, xP = x0, ...
be an unsigned w-bit binary integer sequence with period P, where w is the word size of the intended machine. Let truncv(xi) denote the number formed by the v most significant bits of xi. Consider the kv-bit vectors for the entire period:
- (truncv(xi), truncv(xi+1), ..., truncv(xi+k-1)), i = 0, ..., P-1.
A pseudorandom sequence xi of w-bit integers of period P is said to be k-dimensionally equidistributed with v-bit accuracy if each of the 2kv possible combinations of bits occurs the same number of times over the entire period P, except for the all-zero combination that occurs once less often.
The largest value of k with this property is called the dimension of equidistribution with v-bit accuracy, denoted by k(v).
This definition is based on the assumption that the higher digits are large numbers. In particular, the dimension of equidistribution ensures that the output values with the v most significant bits are uniformly distributed up to dimension k(v). Thus, as a criterion of uniformity, larger values of k(v) for each 1 ≤ v ≤ w is desirable.
Now we have a trivial upper bound
- k(v) ≤ ⌊ log2(P+1) / v ⌋
for each v = 1, 2, ...,w. Define the sum of the gaps
- Δ := ∑ ⌊ log2(P+1) / v ⌋ - k(v)),
where the sum is over all 1 ≤ v ≤ w.
If Δ = 0, the generator is said to be maximally equidistributed (ME)[6].
Performance
[edit]The following table summarizes the CPU time (in seconds) taken to generate 109 64-bit unsigned integers and the figures of merit Δ and N1. Here, N1 is the number of nonzero coefficients of the characteristic polynomial and N1 should be in the vicinity of the half of 19937[7].
Generators | CPU time(Intel) | CPU time(AMD) | Δ | N1 |
---|---|---|---|---|
MELG19937-64[9] | 4.2123 | 6.2920 | 0 | 9603 |
MT19937-64[10] | 5.1002 | 6.6490 | 7820 | 285 |
MT19937-64 (ID3)[11] | 4.8993 | 6.7930 | 7940 | 5795 |
SFMT19937-64[12](with SIMD) | 4.2654 | 5.6123 | 14095 | 6711 |
SFMT19937-64 (with SIMD) | 1.8457 | 2.8806 | 14095 | 6711 |
Platforms (64-bit CPUs and OSs):
- CPU time (Intel): Intel Core i7-3770 (3.40GHz) Linux gcc compiler with -O3
- CPU time (AMD): AMD Phenom II X6 1045T (2.70 GHz) Linux gcc compiler with -O3
References
[edit]- ^ Harase, S.; Kimoto, T. (2018). "Implementing 64-bit Maximally Equidistributed F2-Linear Generators with Mersenne Prime Period". ACM Transactions on Mathematical Software. 44 (3): 30:1–30:11. arXiv:1505.06582. doi:10.1145/3159444.
- ^ Panneton, François; L'Ecuyer, Pierre; Matsumoto, Makoto (2006-03). "Improved long-period generators based on linear recurrences modulo 2". ACM Transactions on Mathematical Software. 32 (1): 1–16. doi:10.1145/1132973.1132974. ISSN 0098-3500.
{{cite journal}}
: Check date values in:|date=
(help) - ^ Tezuka, Shu (1995). Uniform Random Numbers. Boston, MA: Springer US. doi:10.1007/978-1-4615-2317-8. ISBN 978-1-4613-5980-7.
- ^ Mutsuo Saito; Hiroshi Haramoto; Takuji Nishimura (2006). "Pseudorandom Number Generation: Impossibility and Compromise". Journal of Universal Computer Science. 12: 672–690. doi:10.3217/JUCS-012-06-0672.
{{cite journal}}
: More than one of|author=
and|last=
specified (help) - ^ L’Ecuyer, Pierre; Panneton, François (2009). Alexopoulos, Christos; Goldsman, David; Wilson, James R. (eds.). F2-Linear Random Number Generators. Boston, MA: Springer US. pp. 169–193. doi:10.1007/b110059_9. ISBN 978-1-4419-0817-9.
- ^ Tootill, J. P. R.; Robinson, W. D.; Eagle, D. J. (1973-07). "An Asymptotically Random Tausworthe Sequence". Journal of the ACM. 20 (3): 469–481. doi:10.1145/321765.321778. ISSN 0004-5411.
{{cite journal}}
: Check date values in:|date=
(help) - ^ Compagner, Aaldert (1991-06). "The hierarchy of correlations in random binary sequences". Journal of Statistical Physics. 63 (5–6): 883–896. doi:10.1007/BF01029989. ISSN 0022-4715.
{{cite journal}}
: Check date values in:|date=
(help) - ^ Harase, S.; Kimoto, T. (2018). "Implementing 64-bit Maximally Equidistributed F2-Linear Generators with Mersenne Prime Period". ACM Transactions on Mathematical Software. 44 (3): 30:1–30:11. arXiv:1505.06582. doi:10.1145/3159444.
- ^ "GitHub - sharase/melg-64: Implementing 64-bit Maximally Equidistributed F2-Linear Generators with Mersenne Prime Period". GitHub. Retrieved 2021-09-02.
- ^ "Mersenne Twister: A random number generator (since 1997/10)". www.math.sci.hiroshima-u.ac.jp. Retrieved 2021-09-02.
- ^ Nishimura, Takuji (2000-10). "Tables of 64-bit Mersenne twisters". ACM Transactions on Modeling and Computer Simulation. 10 (4): 348–357. doi:10.1145/369534.369540. ISSN 1049-3301.
{{cite journal}}
: Check date values in:|date=
(help) - ^ "SIMD-oriented Fast Mersenne Twister (SFMT)". www.math.sci.hiroshima-u.ac.jp.