summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-25 22:30:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-25 22:30:03 +0000
commit8554e163557a4f32f6e9427146d594df31ac024a (patch)
tree2f433ca9eb7f177befc9631338f5a13f8bb2900a /array.c
parent2034fe610fd9da3781f4a1e39079128da812748c (diff)
* 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. * random.c (rb_random_real): check the range of result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/array.c b/array.c
index 172a653aa2..a21f9ef51e 100644
--- a/array.c
+++ b/array.c
@@ -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);