зеркало из https://github.com/github/ruby.git
[DOC] Improve Random::Formatter description and example
This commit is contained in:
Родитель
6859d175ba
Коммит
dc490aced3
|
@ -3,6 +3,8 @@
|
|||
|
||||
# == Random number formatter.
|
||||
#
|
||||
# Formats generated random numbers in many manors.
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# Generate random hexadecimal strings:
|
||||
|
|
9
random.c
9
random.c
|
@ -1807,7 +1807,14 @@ InitVM_Random(void)
|
|||
rb_define_private_method(CLASS_OF(rb_cRandom), "left", random_s_left, 0);
|
||||
|
||||
{
|
||||
/* Format raw random number as Random does */
|
||||
/*
|
||||
* Generate a random number in the given range as Random does
|
||||
*
|
||||
* prng.random_number #=> 0.5816771641321361
|
||||
* prng.random_number(1000) #=> 485
|
||||
* prng.rand #=> 0.5816771641321361
|
||||
* prng.rand(1000) #=> 485
|
||||
*/
|
||||
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
||||
rb_include_module(base, m);
|
||||
rb_extend_object(base, m);
|
||||
|
|
Загрузка…
Ссылка в новой задаче