summaryrefslogtreecommitdiffstats
path: root/usr/klibc/tests/testrand48.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/tests/testrand48.c')
-rw-r--r--usr/klibc/tests/testrand48.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/klibc/tests/testrand48.c b/usr/klibc/tests/testrand48.c
new file mode 100644
index 0000000..26868c7
--- /dev/null
+++ b/usr/klibc/tests/testrand48.c
@@ -0,0 +1,19 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(void)
+{
+ unsigned short seed1[] = { 0x1234, 0x5678, 0x9abc };
+ unsigned short *oldseed;
+
+ oldseed = seed48(seed1);
+ printf("Initial seed: %#06x %#06x %#06x\n",
+ oldseed[0], oldseed[1], oldseed[2]);
+
+ printf("lrand48() = %ld\n", lrand48());
+
+ seed48(seed1);
+ printf("mrand48() = %ld\n", mrand48());
+
+ return 1;
+}