]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - para.h
Revert "string.c: Use $HOME to get the home directory."
[paraslash.git] / para.h
diff --git a/para.h b/para.h
index f41e8b67acfcf90fe07745fa30b4723245e8e8dd..5dec070f00458bd59d62fbb8fed1b3bc60cb31da 100644 (file)
--- a/para.h
+++ b/para.h
@@ -200,3 +200,14 @@ __printf_2_3 void para_log(int, const char*, ...);
                p = para_realloc(p, size); \
        } \
 }
+
+static inline int para_random(unsigned max)
+{
+       return ((max + 0.0) * (rand() / (RAND_MAX + 1.0)));
+}
+
+/** Round up x to a multiple of y */
+#define ROUND_UP(x, y) (((x) + (y - 1) / (y)) * (y))
+
+/** Get the size of an array */
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))