summaryrefslogtreecommitdiffstats
path: root/include/randutils.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/randutils.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/randutils.h b/include/randutils.h
new file mode 100644
index 0000000..86e35f3
--- /dev/null
+++ b/include/randutils.h
@@ -0,0 +1,17 @@
+#ifndef UTIL_LINUX_RANDUTILS
+#define UTIL_LINUX_RANDUTILS
+
+#ifdef HAVE_SRANDOM
+#define srand(x) srandom(x)
+#define rand() random()
+#endif
+
+/* rand() based */
+extern int rand_get_number(int low_n, int high_n);
+
+/* /dev/urandom based with fallback to rand() */
+extern int random_get_fd(void);
+extern void random_get_bytes(void *buf, size_t nbytes);
+extern const char *random_tell_source(void);
+
+#endif