[DOC] Improve Random::Formatter description and example
This commit is contained in:
parent
6859d175ba
commit
dc490aced3
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
# == Random number formatter.
|
# == Random number formatter.
|
||||||
#
|
#
|
||||||
|
# Formats generated random numbers in many manors.
|
||||||
|
#
|
||||||
# === Examples
|
# === Examples
|
||||||
#
|
#
|
||||||
# Generate random hexadecimal strings:
|
# 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);
|
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");
|
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
||||||
rb_include_module(base, m);
|
rb_include_module(base, m);
|
||||||
rb_extend_object(base, m);
|
rb_extend_object(base, m);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user