From ec720303179b9ddf0c4762d17ed34d22e9ad170e Mon Sep 17 00:00:00 2001 From: zzak Date: Sun, 3 Feb 2013 01:25:57 +0000 Subject: [PATCH] * random.c: Document range argument for Kernel#rand. [ruby-core:51794] [Bug #7770] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ random.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index afae3f0556..36e5583b59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Feb 3 10:25:00 2013 Zachary Scott + + * random.c: Document range argument for Kernel#rand. + [ruby-core:51794] [Bug #7770] + Sun Feb 3 10:00:00 2013 Zachary Scott * numeric.c: Document Float constants [ruby-core:51484] [Bug #7709] diff --git a/random.c b/random.c index 50db6ec393..6e635d912f 100644 --- a/random.c +++ b/random.c @@ -1273,12 +1273,14 @@ random_equal(VALUE self, VALUE other) * * rand #=> 0.2725926052826416 * - * 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. + * 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. *