Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newStdGenPrim :: PrimMonad m => m StdGen
- newtype PrimGen g = PrimGen {
- unPrimGen :: g
- newtype PrimGenM g s = PrimGenM {
- unPrimGenM :: MutVar s g
- newPrimGenM :: PrimMonad m => g -> m (PrimGenM g (PrimState m))
- applyPrimGen :: PrimMonad m => (g -> (a, g)) -> PrimGenM g (PrimState m) -> m a
- withGlobalStdGen :: PrimMonad m => (PrimGenM StdGen (PrimState m) -> m a) -> m (a, StdGen)
- withGlobalStdGen_ :: PrimMonad m => (PrimGenM StdGen (PrimState m) -> m a) -> m a
- withFixedStdGen :: PrimMonad m => Int -> (PrimGenM StdGen (PrimState m) -> m a) -> m (a, StdGen)
- withFixedStdGen_ :: PrimMonad m => Int -> (PrimGenM StdGen (PrimState m) -> m a) -> m a
- shuffle :: (PrimMonad m, MVector mv a, RandomGen g) => g -> mv (PrimState m) a -> m ()
Documentation
newStdGenPrim :: PrimMonad m => m StdGen Source #
global StdGen
Instances
RandomGen g => RandomGen (PrimGen g) Source # | |
Defined in System.Random.Utils next :: PrimGen g -> (Int, PrimGen g) genWord8 :: PrimGen g -> (Word8, PrimGen g) genWord16 :: PrimGen g -> (Word16, PrimGen g) genWord32 :: PrimGen g -> (Word32, PrimGen g) genWord64 :: PrimGen g -> (Word64, PrimGen g) genWord32R :: Word32 -> PrimGen g -> (Word32, PrimGen g) genWord64R :: Word64 -> PrimGen g -> (Word64, PrimGen g) genShortByteString :: Int -> PrimGen g -> (ShortByteString, PrimGen g) | |
(RandomGen g, PrimMonad m) => FrozenGen (PrimGen g) m Source # | |
type MutableGen (PrimGen g) m Source # | |
Defined in System.Random.Utils |
PrimGenM | |
|
Instances
(RandomGen g, s ~ PrimState m, PrimMonad m) => StatefulGen (PrimGenM g s) m Source # | |
Defined in System.Random.Utils uniformWord32R :: Word32 -> PrimGenM g s -> m Word32 uniformWord64R :: Word64 -> PrimGenM g s -> m Word64 uniformWord8 :: PrimGenM g s -> m Word8 uniformWord16 :: PrimGenM g s -> m Word16 uniformWord32 :: PrimGenM g s -> m Word32 uniformWord64 :: PrimGenM g s -> m Word64 uniformShortByteString :: Int -> PrimGenM g s -> m ShortByteString | |
(RandomGen g, s ~ PrimState m, PrimMonad m) => RandomGenM (PrimGenM g s) g m Source # | |
Defined in System.Random.Utils applyRandomGenM :: (g -> (a, g)) -> PrimGenM g s -> m a |
newPrimGenM :: PrimMonad m => g -> m (PrimGenM g (PrimState m)) Source #
applyPrimGen :: PrimMonad m => (g -> (a, g)) -> PrimGenM g (PrimState m) -> m a Source #
withGlobalStdGen :: PrimMonad m => (PrimGenM StdGen (PrimState m) -> m a) -> m (a, StdGen) Source #
withGlobalStdGen_ :: PrimMonad m => (PrimGenM StdGen (PrimState m) -> m a) -> m a Source #
withFixedStdGen :: PrimMonad m => Int -> (PrimGenM StdGen (PrimState m) -> m a) -> m (a, StdGen) Source #
>>>
withFixedStdGen 123 (uniformRM @Int (1, 6))
(1,StdGen {unStdGen = SMGen 3794253433779795923 13032462758197477675})>>>
withFixedStdGen 1 (uniformRM @Int (1, 6))
(6,StdGen {unStdGen = SMGen 4999253871718377453 10451216379200822465})
withFixedStdGen_ :: PrimMonad m => Int -> (PrimGenM StdGen (PrimState m) -> m a) -> m a Source #
>>>
withFixedStdGen_ 123 (uniformRM @Int (1, 6))
1>>>
withFixedStdGen_ 1 (uniformRM @Int (1, 6))
6