summaryrefslogtreecommitdiff
path: root/src/modules/meta2d/v2f.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-07-20 21:43:03 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-07-20 22:29:32 -0700
commit0aba23a14014d84a5ca1e3a2af45608cc9f23044 (patch)
treed1aedf256d0cc66804b602531b17f38ae65f804f /src/modules/meta2d/v2f.h
parentbdf33aae40f998b4cfbd94baf3050009266644c1 (diff)
modules/meta2d: more rand()->rand_r() conversions
Normalized all the randomizers to use til_module_context.seed while in here.
Diffstat (limited to 'src/modules/meta2d/v2f.h')
-rw-r--r--src/modules/meta2d/v2f.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/meta2d/v2f.h b/src/modules/meta2d/v2f.h
index 8f51ee0..088772d 100644
--- a/src/modules/meta2d/v2f.h
+++ b/src/modules/meta2d/v2f.h
@@ -278,19 +278,19 @@ static inline v2f_t * v2f_trilerp(v2f_t *res, const v2f_t *aaa, const v2f_t *aba
}
-static inline v2f_t _v2f_rand(const v2f_t *min, const v2f_t *max)
+static inline v2f_t _v2f_rand(unsigned *seedp, const v2f_t *min, const v2f_t *max)
{
return (v2f_t){
- .x = min->x + (float)rand() * (1.f/RAND_MAX) * (max->x - min->x),
- .y = min->y + (float)rand() * (1.f/RAND_MAX) * (max->y - min->y),
+ .x = min->x + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->x - min->x),
+ .y = min->y + (float)rand_r(seedp) * (1.f/RAND_MAX) * (max->y - min->y),
};
}
-static inline v2f_t * v2f_rand(v2f_t *res, const v2f_t *min, const v2f_t *max)
+static inline v2f_t * v2f_rand(v2f_t *res, unsigned *seedp, const v2f_t *min, const v2f_t *max)
{
if (_v2f_allocated(&res))
- *res = _v2f_rand(min, max);
+ *res = _v2f_rand(seedp, min, max);
return res;
}
© All Rights Reserved