diff --git a/lib/random/formatter.rb b/lib/random/formatter.rb index c48886f9e0..0e80bd0f70 100644 --- a/lib/random/formatter.rb +++ b/lib/random/formatter.rb @@ -3,6 +3,8 @@ # == Random number formatter. # +# Formats generated random numbers in many manors. +# # === Examples # # Generate random hexadecimal strings: diff --git a/random.c b/random.c index 580c1f26eb..32c470bdad 100644 --- a/random.c +++ b/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);