2002-02-01 19:28:30 +00:00
|
|
|
#ifndef _GOOMTOOLS_H
|
|
|
|
#define _GOOMTOOLS_H
|
|
|
|
|
|
|
|
#define NB_RAND 0x10000
|
|
|
|
|
|
|
|
/* in graphic.c */
|
2004-03-15 16:32:54 +00:00
|
|
|
extern int * rand_tab ;
|
|
|
|
extern unsigned short rand_pos ;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
#define RAND_INIT(i) \
|
2005-12-06 19:44:58 +00:00
|
|
|
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 () ;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
#define RAND()\
|
2005-12-06 19:44:58 +00:00
|
|
|
(rand_tab[rand_pos = rand_pos + 1])
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
#define RAND_CLOSE()\
|
2005-12-06 19:44:58 +00:00
|
|
|
free (rand_tab);\
|
|
|
|
rand_tab = 0;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/*#define iRAND(i) ((guint32)((float)i * RAND()/RAND_MAX)) */
|
2002-02-01 19:28:30 +00:00
|
|
|
#define iRAND(i) (RAND()%i)
|
2005-12-06 19:44:58 +00:00
|
|
|
|
2002-02-01 19:28:30 +00:00
|
|
|
#endif
|