new(p1 = v1)
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 (argc == 0) {
rb_check_frozen(obj);
vseed = random_seed();
}
else {
rb_scan_args(argc, argv, "01", &vseed);
rb_check_copyable(obj, vseed);
}
rnd->seed = rand_init(&rnd->mt, vseed);
return obj;
}