summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-02 15:32:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-02 15:32:04 +0000
commita194550e5c3076770a16b44ef3cdd1ab3cb904ed (patch)
tree863f078dcbac2feabe27064c5a486e0faa5a7d55 /random.c
parent59e5d0f1779304baf931f2bd6bf82f168cbc9ef4 (diff)
* random.c (rb_random_int): arguments have to be converted to
integer. [ruby-core:24679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/random.c b/random.c
index 0855a1bc78..487b84a73e 100644
--- a/random.c
+++ b/random.c
@@ -911,9 +911,10 @@ rb_random_int(VALUE obj, VALUE vmax)
if (NIL_P(v)) {
/* range like object support */
if (!(v = range_values(vmax, &beg))) {
- beg = Qundef;
- NUM2LONG(vmax);
+ v = vmax;
}
+ v = rb_to_int(v);
+ beg = rb_to_int(beg);
}
v = rand_int(&rnd->mt, v);
if (NIL_P(v)) v = INT2FIX(0);