aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--random.c7
-rw-r--r--random.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/random.c b/random.c
index 7220bc8..f4ddfb9 100644
--- a/random.c
+++ b/random.c
@@ -1,3 +1,4 @@
+#include "maths.h"
#include "random.h"
int random_table[] = {
@@ -57,3 +58,9 @@ int get_rrange(int mi, int ma) {
int r = ma - mi + 1;
return n % r + mi;
}
+
+int get_rf(void) {
+ int n = get_r();
+ int m = f1 - 1;
+ return n & m;
+}
diff --git a/random.h b/random.h
index 22375a1..8c7cb67 100644
--- a/random.h
+++ b/random.h
@@ -9,5 +9,6 @@ extern int random_table[random_table_count];
int get_r(void);
int get_rrange(int mi, int ma);
+int get_rf(void);
#endif