summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-10 05:44:54 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-10 05:44:54 +0000
commit493f72185499f3fea1212b04d177a0870d6e89c3 (patch)
tree56880f8983a8db79d2e5c080bfd600cf29d63b61 /random.c
parent7c73db266ac8632905438fba5cd9d6216ce4084c (diff)
* 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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/random.c b/random.c
index 64b1cec4b1..9044c77432 100644
--- a/random.c
+++ b/random.c
@@ -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