aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-02 21:22:33 +1000
committerquou <quou@disroot.org>2024-10-02 21:22:33 +1000
commit52d93d98018c47cb9f8d9271e4ded8ab96b7bfbd (patch)
tree84991836537ad5ff1abc795b49706f9f23bb2a7d
parentf430e6080afd75a0c0aecdb0a0223f0f3b23b993 (diff)
get_rf
-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