Skip to content

Commit 965d0b6

Browse files
committed
Simpler way of expressing 2^31 - 1
1 parent c792b51 commit 965d0b6

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/Test/QuickCheck/LCG.purs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ import Math ((%))
1313
import Control.Monad.Eff (Eff())
1414
import Control.Monad.Eff.Random (RANDOM(), randomInt)
1515
import Data.Int (fromNumber, toNumber)
16-
import Data.Int.Bits (shl, (.|.))
17-
import Data.Array (replicate)
18-
import Data.Foldable (product)
16+
import Data.Int.Bits (shl)
1917
import qualified Data.Maybe.Unsafe as U
2018

2119
type Seed = Int
@@ -30,7 +28,7 @@ lcgC = 0
3028

3129
-- | The *modulus*: a magic constant for the linear congruential generator
3230
lcgN :: Int
33-
lcgN = product (replicate 31 2) - 1
31+
lcgN = 1 `shl` 31 - 1
3432

3533
-- | Step the linear congruential generator
3634
lcgNext :: Int -> Int

0 commit comments

Comments
 (0)