summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/prng/drand48.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/prng/drand48.c')
-rw-r--r--libc-top-half/musl/src/prng/drand48.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/prng/drand48.c b/libc-top-half/musl/src/prng/drand48.c
new file mode 100644
index 0000000..08283e2
--- /dev/null
+++ b/libc-top-half/musl/src/prng/drand48.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+#include <inttypes.h>
+#include "rand48.h"
+
+double erand48(unsigned short s[3])
+{
+ union {
+ uint64_t u;
+ double f;
+ } x = { 0x3ff0000000000000ULL | __rand48_step(s, __seed48+3)<<4 };
+ return x.f - 1.0;
+}
+
+double drand48(void)
+{
+ return erand48(__seed48);
+}