aboutsummaryrefslogtreecommitdiff
path: root/src/base/rng/bernoulli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/rng/bernoulli.c')
-rw-r--r--src/base/rng/bernoulli.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/base/rng/bernoulli.c b/src/base/rng/bernoulli.c
new file mode 100644
index 0000000..02f531e
--- /dev/null
+++ b/src/base/rng/bernoulli.c
@@ -0,0 +1,7 @@
+#include "internal.h"
+
+bool
+rngĀ·bernoulli(double f)
+{
+ return rngĀ·random() < f;
+}