From 94fc90c32fb9d6694a95a9c191553aa39eabd10a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 2 Apr 2013 01:57:09 -0400 Subject: Got rid of pure functional randomness and started using IO monad --- Fallen/Point.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Fallen/Point.hs') diff --git a/Fallen/Point.hs b/Fallen/Point.hs index 321f3b0..0dec4bc 100644 --- a/Fallen/Point.hs +++ b/Fallen/Point.hs @@ -34,10 +34,10 @@ module Fallen.Point West -> East -- randomPoint :: Int -> Int -> Int -> Int -> IO Point - randomPoint minX minY maxX maxY rg = do - let (x,rg1) = randomR (minX, maxX) rg :: (Int,StdGen) - let (y,rg2) = randomR (minY, maxY) rg1 :: (Int,StdGen) - ((x,y),rg2) + randomPoint minX minY maxX maxY = do + x <- randomRIO (minX, maxX) + y <- randomRIO (minY, maxY) + return (x,y) -- dirToPoint :: Point -> Point -> [Direction] dirToPoint p1 p2 = horizDirToPoint p1 p2 ++ vertDirToPoint p1 p2 where -- cgit 1.4.1