Skip to content

Instantly share code, notes, and snippets.

@julienXX
Created December 28, 2014 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julienXX/fe106072f5e48504e469 to your computer and use it in GitHub Desktop.
Save julienXX/fe106072f5e48504e469 to your computer and use it in GitHub Desktop.
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