diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-30 12:55:04 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-30 12:55:04 +0000 |
commit | fe22f83ecf03f969860ce8cddc53d9917e32cbc2 (patch) | |
tree | 7cfb4086c1e961b59574fb86557aff4a7cbdbb1f /random.c | |
parent | 6937a3e26f15199cb2c2cd180f2e83d941eaad8b (diff) | |
download | ruby-fe22f83ecf03f969860ce8cddc53d9917e32cbc2.tar.gz |
* random.c (init_genrand): ensure invariant of mt->next and mt->left.
mt->next should always equal mt->state + N + 1 - mt->left.
In fact, 'r = Random.new(0); r == r.dup' has returned false.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r-- | random.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -98,7 +98,7 @@ init_genrand(struct MT *mt, unsigned int s) mt->state[j] &= 0xffffffff; /* for >32 bit machines */ } mt->left = 1; - mt->next = mt->state + N - 1; + mt->next = mt->state + N; } /* initialize by an array with array-length */ |