ruby-changes:70185
From: Nobuyoshi <ko1@a...>
Date: Mon, 13 Dec 2021 19:58:05 +0900 (JST)
Subject: [ruby-changes:70185] 446a11f2c1 (master): [DOC] Add call sequences of Random using a range
https://git.ruby-lang.org/ruby.git/commit/?id=446a11f2c1 From 446a11f2c1a1af007ef6079eada2d8992a13467f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 13 Dec 2021 19:56:11 +0900 Subject: [DOC] Add call sequences of Random using a range --- random.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/random.c b/random.c index 32c470bdad7..20c8f9ec900 100644 --- a/random.c +++ b/random.c @@ -1533,10 +1533,12 @@ rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd) https://github.com/ruby/ruby/blob/trunk/random.c#L1533 /* * call-seq: - * prng.random_number -> float - * prng.random_number(max) -> number - * prng.rand -> float - * prng.rand(max) -> number + * prng.random_number -> float + * prng.random_number(max) -> number + * prng.random_number(range) -> number + * prng.rand -> float + * prng.rand(max) -> number + * prng.rand(range) -> number * * Generates formatted random number from raw random bytes. * See Random#rand. @@ -1641,6 +1643,7 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/random.c#L1643 * call-seq: * Random.rand -> float * Random.rand(max) -> number + * Random.rand(range) -> number */ static VALUE @@ -1812,8 +1815,10 @@ InitVM_Random(void) https://github.com/ruby/ruby/blob/trunk/random.c#L1815 * * prng.random_number #=> 0.5816771641321361 * prng.random_number(1000) #=> 485 + * prng.random_number(1..6) #=> 3 * prng.rand #=> 0.5816771641321361 * prng.rand(1000) #=> 485 + * prng.rand(1..6) #=> 3 */ VALUE m = rb_define_module_under(rb_cRandom, "Formatter"); rb_include_module(base, m); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/