summaryrefslogtreecommitdiff
path: root/src/stdlib/_rand.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-27 19:22:26 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-27 19:22:26 -0500
commitf08b1ae89f4fa107826db7359216f56f43b7fa08 (patch)
tree97d95626b185624bd467c64b071b1d371dfd77cd /src/stdlib/_rand.h
parent225d7a2bebf7a4feed89eff97b5bd6a9c805ada7 (diff)
implement as macro to be shared with rand_r
Diffstat (limited to 'src/stdlib/_rand.h')
-rw-r--r--src/stdlib/_rand.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdlib/_rand.h b/src/stdlib/_rand.h
new file mode 100644
index 00000000..7f7102ef
--- /dev/null
+++ b/src/stdlib/_rand.h
@@ -0,0 +1,4 @@
+#include <limits.h>
+
+#define _rand(_n) \
+ (((_n) = (_n) * 1103515245 + 12345) ? (_n) / UINT_MAX % RAND_MAX : 0)