System.Random: StdGen's genRange doesn't match its next
|Reported by:||rturk@…||Owned by:|
|Type of failure:||Difficulty:||Easy (less than 1 hour)|
|Test Case:||Blocked By:|
> g <- getStdGen > length $ filter (<0) $ take (10^6) $ unfoldr (Just . next) g 0 > genRange g (-2147483648,2147483647)
Apparently, StdGen's next only returns non-negative values.
Also, 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.
Thus, StdGen's next violates the uniform distribution requirement.