зеркало из https://github.com/github/ruby.git
[DOC] Add call sequences of Random using a range
This commit is contained in:
Родитель
dc490aced3
Коммит
446a11f2c1
13
random.c
13
random.c
|
@ -1533,10 +1533,12 @@ rand_random(int argc, VALUE *argv, VALUE obj, rb_random_t *rnd)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* prng.random_number -> float
|
* prng.random_number -> float
|
||||||
* prng.random_number(max) -> number
|
* prng.random_number(max) -> number
|
||||||
* prng.rand -> float
|
* prng.random_number(range) -> number
|
||||||
* prng.rand(max) -> number
|
* prng.rand -> float
|
||||||
|
* prng.rand(max) -> number
|
||||||
|
* prng.rand(range) -> number
|
||||||
*
|
*
|
||||||
* Generates formatted random number from raw random bytes.
|
* Generates formatted random number from raw random bytes.
|
||||||
* See Random#rand.
|
* See Random#rand.
|
||||||
|
@ -1641,6 +1643,7 @@ rb_f_rand(int argc, VALUE *argv, VALUE obj)
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* Random.rand -> float
|
* Random.rand -> float
|
||||||
* Random.rand(max) -> number
|
* Random.rand(max) -> number
|
||||||
|
* Random.rand(range) -> number
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1812,8 +1815,10 @@ InitVM_Random(void)
|
||||||
*
|
*
|
||||||
* prng.random_number #=> 0.5816771641321361
|
* prng.random_number #=> 0.5816771641321361
|
||||||
* prng.random_number(1000) #=> 485
|
* prng.random_number(1000) #=> 485
|
||||||
|
* prng.random_number(1..6) #=> 3
|
||||||
* prng.rand #=> 0.5816771641321361
|
* prng.rand #=> 0.5816771641321361
|
||||||
* prng.rand(1000) #=> 485
|
* prng.rand(1000) #=> 485
|
||||||
|
* prng.rand(1..6) #=> 3
|
||||||
*/
|
*/
|
||||||
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
||||||
rb_include_module(base, m);
|
rb_include_module(base, m);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче