From c1fed8c508dd89c86de7dd647de0d014c441344e Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 21 May 2022 23:27:02 -0700 Subject: modules/*: first stab at utilizing supplied seeds This is a mostly mechanical change of using rand_r() in place of rand(), using the provided seed as the seed state. There's some outstanding rand()s outside of create_context() which should probably get switched over, with the seed being stowed in the context struct. I didn't bother going deeper on this at the moment in the interests of getting to sleep soon. --- src/modules/roto/roto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/roto') diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c index 0969929..8908bd2 100644 --- a/src/modules/roto/roto.c +++ b/src/modules/roto/roto.c @@ -39,8 +39,8 @@ static void * roto_create_context(unsigned seed, unsigned ticks, unsigned n_cpus if (!ctxt) return NULL; - ctxt->r = rand(); - ctxt->rr = rand(); + ctxt->r = rand_r(&seed); + ctxt->rr = rand_r(&seed); return ctxt; } -- cgit v1.2.3