diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-12-06 09:04:03 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-12-06 09:04:03 +0000 |
commit | dee96209bfbb957538c7adeb01a65f3830749179 (patch) | |
tree | 3289aa4829f7fcb044cfa70341caaafd1aa086b0 /random.c | |
parent | 4263bb432accd9bd98654c3e8cc312414e7db906 (diff) |
19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r-- | random.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -126,13 +126,12 @@ rb_f_rand(obj, vmax) long val, max; switch (TYPE(vmax)) { - case T_BIGNUM: - return rb_big_rand(vmax); - case T_FLOAT: - if (RFLOAT(vmax)->value > LONG_MAX || RFLOAT(vmax)->value < LONG_MIN) - return rb_big_rand(rb_dbl2big(RFLOAT(vmax)->value)); - break; + if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN) + break; + /* fall through */ + case T_BIGNUM: + return rb_big_rand(vmax, RANDOM_NUMBER); } max = NUM2LONG(vmax); |