System.Random: StdGen's genRange doesn't match its next
|Reported by:||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Rev(s):|
> g <- getStdGen > length $ filter (<0) $ take (10^6) $ unfoldr (Just . next) g 0 > genRange g (-2147483648,2147483647)
next only returns non-negative values.
StdGen doesn't override de default method
genRange. However, the System.Random docs (http://haskell.org/ghc/docs/latest/html/libraries/base/System-Random.html#v%3Anext) promise:
The next operation returns an Int that is uniformly distributed in the range returned by genRange (including both end points), and a new generator.
next violates the uniform distribution requirement.