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/rtv/rtv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/rtv') diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 6cd9744..3e789ab 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -242,7 +242,7 @@ static void * rtv_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, ctxt->snow_channel.module = &rtv_none_module; if (((rtv_setup_t *)setup)->snow_module) { ctxt->snow_channel.module = til_lookup_module(((rtv_setup_t *)setup)->snow_module); - (void) til_module_create_context(ctxt->snow_channel.module, rand(), ticks, NULL, &ctxt->snow_channel.module_ctxt); + (void) til_module_create_context(ctxt->snow_channel.module, rand_r(&seed), ticks, NULL, &ctxt->snow_channel.module_ctxt); } for (size_t i = 0; i < n_modules; i++) { -- cgit v1.2.1