blob: cb2148e31151437f8b86efe00bbb86c8f8eadd42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef _GOOMTOOLS_H
#define _GOOMTOOLS_H
#define NB_RAND 0x10000
/* in graphic.c */
extern int *rand_tab;
static unsigned short rand_pos;
#define RAND_INIT(i) \
srand (i) ;\
if (!rand_tab) rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
rand_pos = 1 ;\
while (rand_pos != 0) rand_tab [rand_pos++] = rand () ;
static inline int RAND(void) {
++rand_pos;
return rand_tab[rand_pos];
}
#define RAND_CLOSE()\
free (rand_tab);\
rand_tab = 0;
//#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX))
#define iRAND(i) (RAND()%i)
//inline unsigned int RAND(void);
//inline unsigned int iRAND(int i);
#endif
|