зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
6937a3e26f
Коммит
fe22f83ecf
|
@ -1,3 +1,9 @@
|
|||
Thu Jul 30 21:48:56 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* 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.
|
||||
|
||||
Thu Jul 30 21:43:41 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* random.c (random_bytes): use NUM2LONG instead of FIX2LONG because
|
||||
|
|
2
random.c
2
random.c
|
@ -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 */
|
||||
|
|
Загрузка…
Ссылка в новой задаче