123456789_123456789_123456789_123456789_123456789_

Module: Random::Formatter

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Included In:
Defined in: random.c

Overview

Format raw random number as ::Random does

Instance Method Summary

Instance Method Details

#random_numberFloat #random_number(max) ⇒ Numeric #randFloat #rand(max) ⇒ Numeric
Also known as: #random_number

Generates formatted random number from raw random bytes. See Random#rand.

[ GitHub ]

  
# File 'random.c', line 1433

static VALUE
rand_random_number(int argc, VALUE *argv, VALUE obj)
{
    rb_random_t *rnd = try_get_rnd(obj);
    VALUE v = rand_random(argc, argv, obj, rnd);
    if (NIL_P(v)) v = rand_random(0, 0, obj, rnd);
    else if (!v) invalid_argument(argv[0]);
    return v;
}

#random_numberFloat #random_number(max) ⇒ Numeric #randFloat #rand(max) ⇒ Numeric

Alias for #rand.