aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2026-02-21 14:35:10 +1100
committerJustin Bedo <cu@cua0.org>2026-02-21 14:35:10 +1100
commit155a390d1b6c9a5e84aa462a9dd8e1ea27345684 (patch)
tree579b3c6bfd431bc42af291bf0d0aceacac457071 /src
parent6767617cb5bcf4b32fd02c12eb235d66e3dda7d5 (diff)
add top level signatures
Diffstat (limited to 'src')
-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