]> git.bts.cx Git - benzene.git/blob - src/bz/math/random.h
Initial version
[benzene.git] / src / bz / math / random.h
1 #ifndef BZ_MATH_RANDOM_H
2 #define BZ_MATH_RANDOM_H
3
4 #include <bz/types/common.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 extern float bzRandomFloat(float max);
11 extern float bzRandomFloatRange(float v1, float v2);
12 extern uint32_t bzRandomInteger(uint32_t max);
13 extern int32_t bzRandomIntegerRange(int32_t v1, int32_t v2);
14 extern void *bzRandomArrayValue(size_t count, size_t arrayTypeSize, void *array);
15 //extern void *bzRandomArrayValue(pcg32_random_t *rng, size_t count, size_t arrayTypeSize, void *array);
16
17 #define bzRandom(T, ...) (*((T *)bzRandomArrayValue(sizeof((T[]){__VA_ARGS__})/sizeof(T), sizeof(T), (T[]){__VA_ARGS__})))
18
19 #ifdef __cplusplus
20 }
21 #endif
22
23 #endif