* random.c (rb_f_rand, random_s_rand): RDocs for them.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2aeb3b47ee
commit
b5909efd13
@ -1,3 +1,7 @@
|
|||||||
|
Mon Apr 25 08:24:04 2011 Shota Fukumori <sorah@tubusu.net>
|
||||||
|
|
||||||
|
* random.c (rb_f_rand, random_s_rand): RDocs for them.
|
||||||
|
|
||||||
Mon Apr 25 07:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
Mon Apr 25 07:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* random.c (random_s_rand, Init_Random): Random.rand should behave as
|
* random.c (random_s_rand, Init_Random): Random.rand should behave as
|
||||||
|
33
random.c
33
random.c
@ -1199,14 +1199,22 @@ random_equal(VALUE self, VALUE other)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* rand(max=0) -> number
|
* rand(max=0) -> number
|
||||||
*
|
*
|
||||||
* Converts <i>max</i> to an integer using max1 =
|
*
|
||||||
* max<code>.to_i.abs</code>. If _max_ is +nil+ the result is zero, returns a
|
* If <i>max</i> is +Range+, returns a pseudorandom number where
|
||||||
* pseudorandom floating point number greater than or equal to 0.0 and
|
* range.member(number) == true.
|
||||||
* less than 1.0. Otherwise, returns a pseudorandom integer greater
|
*
|
||||||
* than or equal to zero and less than max1. <code>Kernel::srand</code>
|
* Or else converts _max_ to an integer using max1 =
|
||||||
* may be used to ensure repeatable sequences of random numbers between
|
* max<code>.to_i.abs</code>.
|
||||||
* different runs of the program. Ruby currently uses a modified
|
*
|
||||||
* Mersenne Twister with a period of 2**19937-1.
|
* Then if _max_ is +nil+ the result is zero, returns a pseudorandom floating
|
||||||
|
* point number greater than or equal to 0.0 and less than 1.0.
|
||||||
|
*
|
||||||
|
* Otherwise, returns a pseudorandom integer greater than or equal to zero and
|
||||||
|
* less than max1.
|
||||||
|
*
|
||||||
|
* <code>Kernel::srand</code> may be used to ensure repeatable sequences of
|
||||||
|
* random numbers between different runs of the program. Ruby currently uses
|
||||||
|
* a modified Mersenne Twister with a period of 2**19937-1.
|
||||||
*
|
*
|
||||||
* srand 1234 #=> 0
|
* srand 1234 #=> 0
|
||||||
* [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]
|
* [ rand, rand ] #=> [0.191519450163469, 0.49766366626136]
|
||||||
@ -1235,6 +1243,15 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* call-seq:
|
||||||
|
* Random.rand -> float
|
||||||
|
* Random.rand(limit) -> number
|
||||||
|
*
|
||||||
|
* Alias of _Random::DEFAULT.rand_.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
random_s_rand(int argc, VALUE *argv, VALUE obj)
|
random_s_rand(int argc, VALUE *argv, VALUE obj)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user