summaryrefslogtreecommitdiff
path: root/src/modules/compose
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-05-21 23:27:02 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-05-21 23:27:02 -0700
commitc1fed8c508dd89c86de7dd647de0d014c441344e (patch)
treefac4d327c18fe5a2a205a2f4b4ad7f8287ec3536 /src/modules/compose
parente21cdb67718a5d203372fd0c425e8be3e1d273f3 (diff)
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.
Diffstat (limited to 'src/modules/compose')
-rw-r--r--src/modules/compose/compose.c4
1 files changed, 2 insertions, 2 deletions
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);
}
© All Rights Reserved