import System.Random import Text.Printf select :: (Double, Double) -> IO (Double, Double) select (x, y) = do dx <- getStdRandom $ randomR (-5,5) dy <- getStdRandom $ randomR (-5,5) return (x+dx, y+dy) prob :: (Double, Double) -> Double prob (x, y) = 1/(2*pi) * exp(-(x*x+y*y)/2) nextStatus :: (Double, Double) -> IO (Double, Double) nextStatus (x, y) = do (xt, yt) <- select(x, y) let p = min 1 (prob