mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
random.c: compare by rb_equal
* random.c (random_equal): compare seeds by rb_equal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bc7a845a80
commit
a6b221f238
1 changed files with 1 additions and 2 deletions
3
random.c
3
random.c
|
@ -1346,11 +1346,10 @@ random_equal(VALUE self, VALUE other)
|
|||
if (rb_obj_class(self) != rb_obj_class(other)) return Qfalse;
|
||||
r1 = get_rnd(self);
|
||||
r2 = get_rnd(other);
|
||||
if (!RTEST(rb_funcall2(r1->seed, rb_intern("=="), 1, &r2->seed))) return Qfalse;
|
||||
if (memcmp(r1->mt.state, r2->mt.state, sizeof(r1->mt.state))) return Qfalse;
|
||||
if ((r1->mt.next - r1->mt.state) != (r2->mt.next - r2->mt.state)) return Qfalse;
|
||||
if (r1->mt.left != r2->mt.left) return Qfalse;
|
||||
return Qtrue;
|
||||
return rb_equal(r1->seed, r2->seed);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue