Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
import Numeric.Probability.Distribution(T,uniform,decons,norm)
import Data.Maybe(fromJust)
step :: T Rational Integer -> T Rational Integer
step x = norm $ do
cash <- x
if (cash == 0) then
return 0
else do
f <- uniform [flip (-) 1, (*3)]
return (f cash)
result :: [T Rational Integer]
result = iterate step (return 1)
p :: [Rational]
p = map (fromJust . lookup 0 . decons) (tail result)
main =
mapM_ print $ (map fromRational p :: [Double])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.