From 0aba23a14014d84a5ca1e3a2af45608cc9f23044 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 20 Jul 2022 21:43:03 -0700 Subject: modules/meta2d: more rand()->rand_r() conversions Normalized all the randomizers to use til_module_context.seed while in here. --- src/modules/meta2d/meta2d.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/modules/meta2d/meta2d.c') diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c index 1bb8827..b7b6708 100644 --- a/src/modules/meta2d/meta2d.c +++ b/src/modules/meta2d/meta2d.c @@ -82,10 +82,9 @@ static til_module_context_t * meta2d_create_context(unsigned seed, unsigned tick for (int i = 0; i < META2D_NUM_BALLS; i++) { meta2d_ball_t *ball = &ctxt->balls[i]; - /* TODO: add _r() variants of v[23]f_rand()? */ - v2f_rand(&ball->position, &(v2f_t){-.7f, -.7f}, &(v2f_t){.7f, .7f}); - ball->radius = rand_r(&seed) / (float)RAND_MAX * .2f + .05f; - v3f_rand(&ball->color, &(v3f_t){0.f, 0.f, 0.f}, &(v3f_t){1.f, 1.f, 1.f}); + v2f_rand(&ball->position, &ctxt->til_module_context.seed, &(v2f_t){-.7f, -.7f}, &(v2f_t){.7f, .7f}); + ball->radius = rand_r(&ctxt->til_module_context.seed) / (float)RAND_MAX * .2f + .05f; + v3f_rand(&ball->color, &ctxt->til_module_context.seed, &(v3f_t){0.f, 0.f, 0.f}, &(v3f_t){1.f, 1.f, 1.f}); } return &ctxt->til_module_context; -- cgit v1.2.1