new(*args)
public
Creates a new PRNG using seed to set the initial state. If seed is omitted, the generator is
initialized with Random.new_seed.
See Random.srand for more information on the use
of seed values.
static VALUE
random_init(int argc, VALUE *argv, VALUE obj)
{
VALUE vseed;
rb_random_t *rnd = get_rnd(obj);
if (rb_check_arity(argc, 0, 1) == 0) {
rb_check_frozen(obj);
vseed = random_seed();
}
else {
vseed = argv[0];
rb_check_copyable(obj, vseed);
vseed = rb_to_int(vseed);
}
rnd->seed = rand_init(&rnd->mt, vseed);
return obj;
}