diff options
-rw-r--r-- | rand.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -89,12 +89,6 @@ static rand32_t rand_tab[16] = { 0x88A74E05U, 0xC1CBAEC2U, 0x8170BEADU, 0x29FAF776U }; -static val make_state(void) -{ - struct rand_state *r = coerce(struct rand_state *, chk_malloc(sizeof *r)); - return cobj(coerce(mem_t *, r), random_state_cls, &random_state_ops); -} - val random_state_p(val obj) { return cobjclassp(obj, random_state_cls); @@ -148,9 +142,9 @@ static rand32_t (*rand32)(struct rand_state *) = rand32_good; val make_random_state(val seed, val warmup) { val self = lit("make-random-state"); - val rs = make_state(); + struct rand_state *r = coerce(struct rand_state *, chk_malloc(sizeof *r)); + val rs = cobj(coerce(mem_t *, r), random_state_cls, &random_state_ops); int i = 0; - struct rand_state *r = coerce(struct rand_state *, rs->co.handle); seed = default_null_arg(seed); warmup = default_null_arg(warmup); |