{- | module: $Header$ description: Probability license: MIT maintainer: Joe Leslie-Hurd stability: provisional portability: portable -} module OpenTheory.Natural.Geometric where import qualified OpenTheory.Primitive.Natural as Natural import qualified OpenTheory.Primitive.Random as Random random :: Random.Random -> Natural.Natural random = loop 0 where {-loop :: Natural.Natural -> Random.Random -> Natural.Natural-} loop n r = let (r1, r2) = Random.split r in if Random.bit r1 then n else loop (n + 1) r2