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/compose/compose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/compose') diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index b0f0104..f55e516 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -90,7 +90,7 @@ static void * compose_create_context(unsigned seed, unsigned ticks, unsigned n_c (void) til_module_randomize_setup(layer_module, &layer_setup, NULL); ctxt->layers[i].module = layer_module; - (void) til_module_create_context(layer_module, rand(), ticks, layer_setup, &ctxt->layers[i].module_ctxt); + (void) til_module_create_context(layer_module, rand_r(&seed), ticks, layer_setup, &ctxt->layers[i].module_ctxt); til_setup_free(layer_setup); ctxt->n_layers++; @@ -102,7 +102,7 @@ static void * compose_create_context(unsigned seed, unsigned ticks, unsigned n_c ctxt->texture.module = til_lookup_module(((compose_setup_t *)setup)->texture); (void) til_module_randomize_setup(ctxt->texture.module, &texture_setup, NULL); - (void) til_module_create_context(ctxt->texture.module, rand(), ticks, texture_setup, &ctxt->texture.module_ctxt); + (void) til_module_create_context(ctxt->texture.module, rand_r(&seed), ticks, texture_setup, &ctxt->texture.module_ctxt); til_setup_free(texture_setup); } -- cgit v1.2.3