Module: Random::Formatter
- 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.
1478 1479 1480 1481 1482 1483 1484 1485 1486 |
# File 'random.c', line 1478
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.
1478 1479 1480 1481 1482 1483 1484 1485 1486 |
# File 'random.c', line 1478
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;
}
|