Module: Random::Formatter
- Included in:
- Random
- Defined in:
- random.c
Instance Method Summary collapse
-
#rand(*args) ⇒ Object
Generates formatted random number from raw random bytes.
-
#random_number(*args) ⇒ Object
Generates formatted random number from raw random bytes.
Instance Method Details
#random_number ⇒ Float #random_number(max) ⇒ Numeric #rand ⇒ Float #rand(max) ⇒ Numeric
Generates formatted random number from raw random bytes. See Random#rand.
1298 1299 1300 1301 1302 1303 1304 1305 1306 |
# File 'random.c', line 1298
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_number ⇒ Float #random_number(max) ⇒ Numeric #rand ⇒ Float #rand(max) ⇒ Numeric
Generates formatted random number from raw random bytes. See Random#rand.
1298 1299 1300 1301 1302 1303 1304 1305 1306 |
# File 'random.c', line 1298
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;
}
|