From af21b876efde47274a36d8a13d2c7503034227d0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 17 Jul 2022 22:52:00 -0700 Subject: til: wire seed up to til randomizers til_setting_desc_t.random() and til_module_randomize_setup() now take seeds. Note they are not taking a pointer to a shared seed, but instead receive the seed by value. If a caller wishes the seed to evolve on every invocation into these functions, it should simply insert a rand_r(&seed) in producing the supplied seed value. Within a given randomizer, the seed evolves when appropriate. But isolating the effects by default seems appropriate, so callers can easily have determinism within their respective scope regardless of how much nested random use occurs. --- src/modules/montage/montage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules/montage') diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 820e67d..7991e3f 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -89,7 +89,7 @@ static til_module_context_t * montage_create_context(unsigned seed, unsigned tic const til_module_t *module = ctxt->modules[i]; til_setup_t *setup = NULL; - (void) til_module_randomize_setup(module, &setup, NULL); + (void) til_module_randomize_setup(module, rand_r(&seed), &setup, NULL); /* FIXME errors */ (void) til_module_create_context(module, rand_r(&seed), ticks, 1, setup, &ctxt->contexts[i]); -- cgit v1.2.1