12
I just learned about random function.
To my understanding, random function takes a value of type which is an instance of RandomGen and returns a random value whose value we can specify. On the other hand, mksdGen takes an Int and generates a random generator which random function needs.
I was trying to generate random Bool values. In order to do that, I made a function randomBool.
randomBool :: Int -> Bool
randomBool = fst . random . mkStdGen
Then I found a lot more Trues than Falses with small numbers.
And I was curious about it and checked as following
> length $ takeWhile randomBool [1..]
53667
I think this means that for the first 53667 positive integers, random . mkStdGen returns True, which do not seem to be very random to me.
Is it very normal? Or am I doing something wrong that make True happen more easily?