diff options
author | quou <quou@disroot.org> | 2024-10-02 21:22:33 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-10-02 21:22:33 +1000 |
commit | 52d93d98018c47cb9f8d9271e4ded8ab96b7bfbd (patch) | |
tree | 84991836537ad5ff1abc795b49706f9f23bb2a7d | |
parent | f430e6080afd75a0c0aecdb0a0223f0f3b23b993 (diff) |
get_rf
-rw-r--r-- | random.c | 7 | ||||
-rw-r--r-- | random.h | 1 |
2 files changed, 8 insertions, 0 deletions
@@ -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; +} @@ -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 |