xine-lib  1.2.9
goom_tools.h
Go to the documentation of this file.
1 #ifndef _GOOMTOOLS_H
2 #define _GOOMTOOLS_H
3 
8 #define GOOM_NB_RAND 0x10000
9 
10 typedef struct _GOOM_RANDOM {
12  unsigned short pos;
13 } GoomRandom;
14 
16 void goom_random_free(GoomRandom *grandom);
17 
18 inline static int goom_random(GoomRandom *grandom) {
19 
20  grandom->pos++; /* works because pos is an unsigned short */
21  return grandom->array[grandom->pos];
22 }
23 
24 inline static int goom_irand(GoomRandom *grandom, int i) {
25 
26  grandom->pos++;
27  return grandom->array[grandom->pos] % i;
28 }
29 
30 /* called to change the specified number of value in the array, so that the array does not remain the same*/
31 void goom_random_update_array(GoomRandom *grandom, int numberOfValuesToChange);
32 
33 #endif
#define GOOM_NB_RAND
Definition: goom_tools.h:8
unsigned short pos
Definition: goom_tools.h:12
GoomRandom * goom_random_init(int i)
Definition: goom_tools.c:9
static int goom_random(GoomRandom *grandom)
Definition: goom_tools.h:18
int array[0x10000]
Definition: goom_tools.h:11
void goom_random_update_array(GoomRandom *grandom, int numberOfValuesToChange)
Definition: goom_tools.c:20
struct _GOOM_RANDOM GoomRandom
Definition: goom_tools.h:10
void goom_random_free(GoomRandom *grandom)
Definition: goom_tools.c:16
static int goom_irand(GoomRandom *grandom, int i)
Definition: goom_tools.h:24