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 /random.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 'random.c')
-rw-r--r-- | random.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -875,11 +875,16 @@ limited_big_rand(struct MT *mt, struct RBignum *limit) return rb_big_norm((VALUE)val); } +/* + * Returns random unsigned long value in [0, _limit_]. + * + * Note that _limit_ is included, and the range of the argument and the + * return value depends on environments. + */ unsigned long -rb_rand_internal(unsigned long i) +rb_genrand_ulong_limited(unsigned long limit) { - struct MT *mt = default_mt(); - return limited_rand(mt, i); + return limited_rand(default_mt(), limit); } unsigned int |