aboutsummaryrefslogtreecommitdiff
path: root/src/PPL/Distr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/PPL/Distr.hs')
-rw-r--r--src/PPL/Distr.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/PPL/Distr.hs b/src/PPL/Distr.hs
index 54db358..cd8f029 100644
--- a/src/PPL/Distr.hs
+++ b/src/PPL/Distr.hs
@@ -102,6 +102,7 @@ geom p = first 0 <$> iid (bern p)
first n (_ : xs) = first (n + 1) xs
first _ _ = undefined
+uniform :: Prob Double
uniform = do
z <- unbounded
let r = countTrailingZeros z - 11
@@ -129,6 +130,7 @@ bounded lower upper = do
s = b / g - a / g
eps = if abs a <= abs b then negate a / g - (s - b / g) else b / g - (s + a / g)
+unbounded :: Prob Word64
unbounded = Prob draw
bounded' :: Integral a => a -> a -> Prob a