diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-07-20 12:39:52 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-07-20 17:50:42 -0700 |
commit | c0881f0be992c43f85e794bd160fddb4ffb6d951 (patch) | |
tree | f6750fb93ff204331c46ca91b82884d169b647e3 /src/modules | |
parent | 7811276578e55be0950a1bdd5c9328bb9e29c6df (diff) |
modules/submit: wire up seed to randomizers
More plumbing seed to rand in the obvious way...
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/submit/submit.c | 6 |
1 files changed, 4 insertions, 2 deletions
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++) |