aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/inc/rand.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libc/inc/rand.h')
-rw-r--r--libs/libc/inc/rand.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/libc/inc/rand.h b/libs/libc/inc/rand.h
new file mode 100644
index 0000000..1b41df5
--- /dev/null
+++ b/libs/libc/inc/rand.h
@@ -0,0 +1,15 @@
+// MIT License, Copyright (c) 2020 Marvin Borner
+
+#ifndef RANDOM_H
+#define RANDOM_H
+
+#include <def.h>
+
+#define rand_range(min, max) (rand() % ((max) + 1 - (min)) + (min))
+
+void srand(u32 seed);
+u32 rand(void);
+void rand_fill(void *buf, u32 size);
+char *randstr(u32 size);
+
+#endif