* array.c (rb_ary_{shuffle_bang,sample}): use Random class object.

* random.c (try_get_rnd): use default_rand for Random as same as
  singleton methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-08-25 09:00:17 +00:00
parent 569d821929
commit ae6a9009dc
3 changed files with 20 additions and 7 deletions

View file

@ -3748,7 +3748,7 @@ static VALUE sym_random;
static VALUE
rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
{
VALUE *ptr, opts, randgen = Qnil;
VALUE *ptr, opts, randgen = rb_cRandom;
long i = RARRAY_LEN(ary);
if (OPTHASH_GIVEN_P(opts)) {
@ -3811,7 +3811,7 @@ static VALUE
rb_ary_sample(int argc, VALUE *argv, VALUE ary)
{
VALUE nv, result, *ptr;
VALUE opts, randgen = Qnil;
VALUE opts, randgen = rb_cRandom;
long n, len, i, j, k, idx[10];
len = RARRAY_LEN(ary);