[commit: packages/random] master: The lowest int generated by StdGen is 1. Fixes ghc #8899. (485cbf1)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 15:44:50 UTC 2015
Repository : ssh://git@git.haskell.org/random
On branch : master
Link : http://git.haskell.org/packages/random.git/commitdiff/485cbf1ab6ba08a014a470e7109221f91a5e321a
>---------------------------------------------------------------
commit 485cbf1ab6ba08a014a470e7109221f91a5e321a
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date: Tue Jul 8 14:06:40 2014 +0200
The lowest int generated by StdGen is 1. Fixes ghc #8899.
This follows from the following line in the function stdNext
(z' is the next generated Int):
z' = if z < 1 then z + 2147483562 else z
>---------------------------------------------------------------
485cbf1ab6ba08a014a470e7109221f91a5e321a
System/Random.hs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/System/Random.hs b/System/Random.hs
index 665dd78..defb8e4 100644
--- a/System/Random.hs
+++ b/System/Random.hs
@@ -494,7 +494,7 @@ int32Count :: Integer
int32Count = toInteger (maxBound::Int32) - toInteger (minBound::Int32) + 1
stdRange :: (Int,Int)
-stdRange = (0, 2147483562)
+stdRange = (1, 2147483562)
stdNext :: StdGen -> (Int, StdGen)
-- Returns values in the range stdRange
More information about the ghc-commits
mailing list