summaryrefslogtreecommitdiff
path: root/src/post/goom/goom_tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/goom/goom_tools.h')
-rw-r--r--src/post/goom/goom_tools.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/post/goom/goom_tools.h b/src/post/goom/goom_tools.h
index 2bd74b95b..8e4fdd314 100644
--- a/src/post/goom/goom_tools.h
+++ b/src/post/goom/goom_tools.h
@@ -5,25 +5,29 @@
/* in graphic.c */
extern int *rand_tab;
-extern unsigned short rand_pos;
+static unsigned short rand_pos;
#define RAND_INIT(i) \
srand (i) ;\
- if (!rand_tab)\
- rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
+ if (!rand_tab) rand_tab = (int *) malloc (NB_RAND * sizeof(int)) ;\
rand_pos = 1 ;\
- while (rand_pos != 0)\
- rand_tab [rand_pos++] = rand () ;
+ while (rand_pos != 0) rand_tab [rand_pos++] = rand () ;
-#define RAND()\
- (rand_tab[rand_pos = (rand_pos + 1) % NB_RAND])
+
+static inline int RAND() {
+ ++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) ((guint32)((float)i * RAND()/RAND_MAX))
#define iRAND(i) (RAND()%i)
+//inline unsigned int RAND(void);
+//inline unsigned int iRAND(int i);
+
#endif