[前][次][番号順一覧][スレッド一覧]

ruby-changes:70260

From: Nobuyoshi <ko1@a...>
Date: Thu, 16 Dec 2021 19:57:34 +0900 (JST)
Subject: [ruby-changes:70260] cf54de637c (master): [DOC] random number by range

https://git.ruby-lang.org/ruby.git/commit/?id=cf54de637c

From cf54de637ce3747f9a761ca14edce7cf77f0e813 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 16 Dec 2021 18:00:23 +0900
Subject: [DOC] random number by range

---
 random.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/random.c b/random.c
index 20c8f9ec900..bf9479168bf 100644
--- a/random.c
+++ b/random.c
@@ -1469,6 +1469,7 @@ static VALUE rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd); https://github.com/ruby/ruby/blob/trunk/random.c#L1469
  * call-seq:
  *   prng.rand -> float
  *   prng.rand(max) -> number
+ *   prng.rand(range) -> number
  *
  * When +max+ is an Integer, +rand+ returns a random integer greater than
  * or equal to zero and less than +max+. Unlike Kernel.rand, when +max+
@@ -1482,8 +1483,8 @@ static VALUE rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd); https://github.com/ruby/ruby/blob/trunk/random.c#L1483
  *
  *   prng.rand(1.5)       # => 1.4600282860034115
  *
- * When +max+ is a Range, +rand+ returns a random number where
- * range.member?(number) == true.
+ * When +range+ is a Range, +rand+ returns a random number where
+ * <code>range.member?(number) == true</code>.
  *
  *   prng.rand(5..9)      # => one of [5, 6, 7, 8, 9]
  *   prng.rand(5...9)     # => one of [5, 6, 7, 8]
@@ -1644,6 +1645,9 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj) https://github.com/ruby/ruby/blob/trunk/random.c#L1645
  *   Random.rand -> float
  *   Random.rand(max) -> number
  *   Random.rand(range) -> number
+ *
+ * Generates a random number by the default PRNG.
+ * See Random#rand.
  */
 
 static VALUE
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]