Created
December 28, 2014 20:03
-
-
Save julienXX/fe106072f5e48504e469 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
import Data.List.Split | |
randomCells :: Int -> StdGen -> [Int] | |
randomCells size gen = take size $ randomRs (0, 1) gen | |
createGeneration :: [Int] -> Int -> [[Int]] | |
createGeneration cells width = splitEvery width cells | |
main :: IO() -- declare type signature | |
main = | |
let cells = randomCells 12 (mkStdGen 123) | |
in print (createGeneration cells 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment