aboutsummaryrefslogtreecommitdiff
path: root/random.c
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 /random.c
parentf430e6080afd75a0c0aecdb0a0223f0f3b23b993 (diff)
get_rf
Diffstat (limited to 'random.c')
-rw-r--r--random.c7
1 files changed, 7 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;
+}