diff options
Diffstat (limited to 'src/modules/meta2d/v2f.h')
-rw-r--r-- | src/modules/meta2d/v2f.h | 10 |
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; } |