diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2020-05-04 17:52:06 +0100 |
---|---|---|
committer | Kevin Sheppard <kevin.sheppard@gmail.com> | 2020-05-12 22:39:47 +0100 |
commit | 3bc2c0daee4f72b3c2decb470b4d0dd4941ce5f9 (patch) | |
tree | d18a1c740bbeaa5167e7d87ec092c87577922ac2 /numpy/random/src | |
parent | beb031d64b42f4643d1ba5186c091fb1328ac8c9 (diff) | |
download | numpy-3bc2c0daee4f72b3c2decb470b4d0dd4941ce5f9.tar.gz |
BUG: Correct loop order in MT19937 jump
Use the original loop order instead of an inverted order
closes #15394
Diffstat (limited to 'numpy/random/src')
-rw-r--r-- | numpy/random/src/mt19937/mt19937-jump.c | 4 | ||||
-rw-r--r-- | numpy/random/src/mt19937/mt19937-poly.h | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/numpy/random/src/mt19937/mt19937-jump.c b/numpy/random/src/mt19937/mt19937-jump.c index 46b28cf96..de8969bf9 100644 --- a/numpy/random/src/mt19937/mt19937-jump.c +++ b/numpy/random/src/mt19937/mt19937-jump.c @@ -187,11 +187,9 @@ void mt19937_jump_state(mt19937_state *state, const char *jump_str) { pf = (unsigned long *)calloc(P_SIZE, sizeof(unsigned long)); for (i = MEXP - 1; i > -1; i--) { - if (jump_str[i] == '1') + if (jump_str[(MEXP - 1) - i] == '1') set_coef(pf, i, 1); } - /* TODO: Should generate the next set and start from 0, but doesn't matter ?? - */ if (state->pos >= N) { state->pos = 0; } diff --git a/numpy/random/src/mt19937/mt19937-poly.h b/numpy/random/src/mt19937/mt19937-poly.h index b03747881..016b4f626 100644 --- a/numpy/random/src/mt19937/mt19937-poly.h +++ b/numpy/random/src/mt19937/mt19937-poly.h @@ -1,3 +1,11 @@ +/* + * 2**128 step polynomial produced using the file mt19937-generate-jump-poly.c + * (randomgen) which is a modified version of minipoly_mt19937.c as distributed + * in http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/JUMP/jump_ahead_1.02.tar.gz + * + * These files are not part of NumPy. + */ + static const char * poly = "0001000111110111011100100010101111000000010100100101000001110111100010101000110100101001011001010" "1110101101100101011100101101011001110011100011110100001000001011100101100010100000010011101110011" |