Created
October 22, 2014 18:29
-
-
Save codedmart/5580962237c262e52afa 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 | |
-- takes a random generator and returns a list of strings of 50 chars | |
start_population :: (RandomGen g) => g -> [[Char]] | |
start_population gen = | |
[take 50 $ randomRs ('A', 'z') gen | x <- [0..]] | |
main = do | |
randomGen <- newStdGen -- get a random generator | |
print $ take 2 $ start_population randomGen -- use it as a function argument |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but the problem is, that the RandomGen doesnt get updated, so every 50 char string from start_population is the same. instead you need to pull 50 char chunks from the original randomRs call like so: