Commit 7ae59e0f authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a comment about why we can't use abs to get a non-negative number

NB: Negative seends will now produce different random numbers than
they used to.
parent d8e406fd
......@@ -221,6 +221,8 @@ mkStdGen s = mkStdGen32 $ fromIntegral s
mkStdGen32 :: Int32 -> StdGen
mkStdGen32 sMaybeNegative = StdGen (s1+1) (s2+1)
where
-- We want a non-negative number, but we can't just take the abs
-- of sMaybeNegative as -minBound == minBound.
s = sMaybeNegative .&. maxBound
(q, s1) = s `divMod` 2147483562
s2 = q `mod` 2147483398
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment