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

ruby-changes:26973

From: zzak <ko1@a...>
Date: Sun, 3 Feb 2013 10:31:30 +0900 (JST)
Subject: [ruby-changes:26973] zzak:r39025 (trunk): * random.c: Document range argument for Kernel#rand.

zzak	2013-02-03 10:25:57 +0900 (Sun, 03 Feb 2013)

  New Revision: 39025

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39025

  Log:
    * random.c: Document range argument for Kernel#rand.
      [ruby-core:51794] [Bug #7770]

  Modified files:
    trunk/ChangeLog
    trunk/random.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39024)
+++ ChangeLog	(revision 39025)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb  3 10:25:00 2013  Zachary Scott  <zachary@z...>
+
+	* random.c: Document range argument for Kernel#rand.
+	  [ruby-core:51794] [Bug #7770]
+
 Sun Feb  3 10:00:00 2013  Zachary Scott  <zachary@z...>
 
 	* numeric.c: Document Float constants [ruby-core:51484] [Bug #7709]
Index: random.c
===================================================================
--- random.c	(revision 39024)
+++ random.c	(revision 39025)
@@ -1273,12 +1273,14 @@ random_equal(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/random.c#L1273
  *
  *   rand        #=> 0.2725926052826416
  *
- * When <tt>max.abs</tt> is greater than or equal to 1, +rand+ returns a
- * pseudo-random integer greater than or equal to 0 and less than
- * <tt>max.to_i.abs</tt>.
+ * When +max.abs+ is greater than or equal to 1, +rand+ returns a pseudo-random
+ * integer greater than or equal to 0 and less than +max.to_i.abs+.
  *
  *   rand(100)   #=> 12
  *
+ * When +max+ is a Range, +rand+ returns a random number where
+ * range.member?(number) == true.
+ *
  * Negative or floating point values for +max+ are allowed, but may give
  * surprising results.
  *

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

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