MythTV  master
goom_tools.h
Go to the documentation of this file.
1 #ifndef _GOOMTOOLS_H
2 #define _GOOMTOOLS_H
3 
4 #if !defined( M_PI )
5  #define M_PI 3.14159265358979323846
6 #endif
7 #define M_PI_F ((float)M_PI)
8 
9 #define NB_RAND 0x10000
10 
11 /* in graphic.c */
12 extern int *rand_tab;
13 static unsigned short rand_pos;
14 
15 #define RAND_INIT(i) \
16  srand (i) ;\
17  if (!rand_tab) rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
18  rand_pos = 1 ;\
19  while (rand_pos != 0) rand_tab [rand_pos++] = rand () ;
20 
21 
22 static inline int RAND(void) {
23  ++rand_pos;
24  return rand_tab[rand_pos];
25 }
26 
27 #define RAND_CLOSE()\
28  free (rand_tab);\
29  rand_tab = 0;
30 
31 
32 //#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX))
33 #define iRAND(i) (RAND()%(i))
34 
35 //inline unsigned int RAND(void);
36 //inline unsigned int iRAND(int i);
37 
38 #endif
static unsigned short rand_pos
Definition: goom_tools.h:13
int * rand_tab
Definition: graphic.c:16
static int RAND(void)
Definition: goom_tools.h:22