From c0881f0be992c43f85e794bd160fddb4ffb6d951 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 20 Jul 2022 12:39:52 -0700 Subject: modules/submit: wire up seed to randomizers More plumbing seed to rand in the obvious way... --- src/modules/submit/submit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/modules/submit') diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c index 3e25dc5..daac37b 100644 --- a/src/modules/submit/submit.c +++ b/src/modules/submit/submit.c @@ -304,10 +304,12 @@ static void submit_prepare_frame(til_module_context_t *context, unsigned ticks, setup_grid(ctxt); for (int i = 0; i < NUM_PLAYERS; i++) { - int moves = rand() % TICKS_PER_FRAME; + int moves = rand_r(&ctxt->til_module_context.seed) % TICKS_PER_FRAME; for (int j = 0; j < moves; j++) - grid_player_plan(ctxt->players[i], ctxt->seq++, rand() % GRID_SIZE, rand() % GRID_SIZE); + grid_player_plan(ctxt->players[i], ctxt->seq++, + rand_r(&ctxt->til_module_context.seed) % GRID_SIZE, + rand_r(&ctxt->til_module_context.seed) % GRID_SIZE); } for (int j = 0; j < TICKS_PER_FRAME; j++) -- cgit v1.2.3