summaryrefslogtreecommitdiff
path: root/src/stdlib/srand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/srand.c')
-rw-r--r--src/stdlib/srand.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/stdlib/srand.c b/src/stdlib/srand.c
new file mode 100644
index 00000000..66ce786e
--- /dev/null
+++ b/src/stdlib/srand.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include "nonstd/internal.h"
+
+/** seed the pseudo-random number generator **/
+
+void srand(unsigned int seed)
+{
+ *((int*)__libc(RAND)) = seed;
+}
+
+/***
+seeds the pseudo-random number generator with ARGUMENT(seed). The
+sequence of pseudo-random numbers generated by a single seed is repeatable.
+Program execution begins with a seed of 1.
+***/
+
+/*
+STDC(1)
+*/