diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-07-17 22:52:00 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-07-18 01:06:05 -0700 |
commit | af21b876efde47274a36d8a13d2c7503034227d0 (patch) | |
tree | 131358787058f953270fa388cc46e77389e9ddfd /src/modules/rtv | |
parent | 209b11f99c801141b79802cd6c23a2b568286f75 (diff) |
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.
Diffstat (limited to 'src/modules/rtv')
-rw-r--r-- | src/modules/rtv/rtv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 97c7a67..9714368 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -170,7 +170,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) char *settings_as_arg = NULL; txt_t *caption; - (void) til_module_randomize_setup(ctxt->channel->module, &ctxt->channel->module_setup, &settings_as_arg); + (void) til_module_randomize_setup(ctxt->channel->module, rand_r(&ctxt->til_module_context.seed), &ctxt->channel->module_setup, &settings_as_arg); caption = txt_newf("Title: %s%s%s\nDescription: %s%s%s", ctxt->channel->module->name, ctxt->channel->module->author ? "\nAuthor: " : "", |