diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-10 05:44:54 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-10 05:44:54 +0000 |
commit | 493f72185499f3fea1212b04d177a0870d6e89c3 (patch) | |
tree | 56880f8983a8db79d2e5c080bfd600cf29d63b61 /bignum.c | |
parent | 7c73db266ac8632905438fba5cd9d6216ce4084c (diff) | |
download | ruby-493f72185499f3fea1212b04d177a0870d6e89c3.tar.gz |
* random.c (rb_genrand_ulong_limited): renamed from
rb_rand_internal and now this is public API.
* include/ruby/ruby.h (rb_genrand_ulong_limited): added.
* bignum.c (big_sparse_p): use rb_genrand_ulong_limited.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -2214,11 +2214,10 @@ static inline VALUE big_sparse_p(VALUE x) { long c = 0, n = RBIGNUM_LEN(x); - unsigned long rb_rand_internal(unsigned long i); - if ( BDIGITS(x)[rb_rand_internal(n / 2) + n / 4]) c++; - if (c <= 1 && BDIGITS(x)[rb_rand_internal(n / 2) + n / 4]) c++; - if (c <= 1 && BDIGITS(x)[rb_rand_internal(n / 2) + n / 4]) c++; + if ( BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++; + if (c <= 1 && BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++; + if (c <= 1 && BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++; return (c <= 1) ? Qtrue : Qfalse; } |