aboutsummaryrefslogtreecommitdiff
path: root/lib/PenroseRand.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PenroseRand.c')
-rw-r--r--lib/PenroseRand.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/PenroseRand.c b/lib/PenroseRand.c
new file mode 100644
index 0000000..98f396e
--- /dev/null
+++ b/lib/PenroseRand.c
@@ -0,0 +1,13 @@
+#include "PenroseRand.h"
+
+float rrand(int *seed)
+{
+ int i = ((*seed = *seed * 1103515245 + 12345)>>16) & 077777;
+ return((float)i/16384. - 1.);
+}
+
+float prand(int *seed)
+{
+ int i = ((*seed = *seed * 1103515245 + 12345)>>16) & 077777;
+ return((float)i/32768.);
+}