4 #include "goom_config.h"
7 * Random number generator wrapper for faster random number.
10 #define GOOM_NB_RAND 0x10000
12 typedef struct _GOOM_RANDOM {
13 int array[GOOM_NB_RAND];
17 GoomRandom *goom_random_init(int i);
18 void goom_random_free(GoomRandom *grandom);
20 inline static int goom_random(GoomRandom *grandom) {
22 grandom->pos++; /* works because pos is an unsigned short */
23 return grandom->array[grandom->pos];
26 inline static int goom_irand(GoomRandom *grandom, int i) {
29 return grandom->array[grandom->pos] % i;
32 /* called to change the specified number of value in the array, so that the array does not remain the same*/
33 void goom_random_update_array(GoomRandom *grandom, int numberOfValuesToChange);