summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index aba88df..d823d9c 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2010,11 +2010,14 @@ rb_big_rand(max, rand_buf)
return rb_float_new(rand_buf[0]);
}
v = bignew(len,1);
+ RBIGNUM(v)->sign = RBIGNUM(max)->sign;
+ len--;
+ BDIGITS(v)[len] = BDIGITS(max)[len] * rand_buf[len];
while (len--) {
BDIGITS(v)[len] = ((BDIGIT)~0) * rand_buf[len];
}
- return rb_big_modulo((VALUE)v, max);
+ return v;
}
/*