Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.ULID.Random
Description
Helper functions to generate the random part of an ULID either with PRNGs or TRNGs.
Synopsis
- data ULIDRandom
- mkCryptoULIDRandom :: CryptoRandomGen g => g -> Either GenError (ULIDRandom, g)
- mkULIDRandom :: RandomGen g => g -> (ULIDRandom, g)
- getULIDRandom :: IO ULIDRandom
Documentation
data ULIDRandom Source #
Newtype wrapping a ByteString
Instances
Eq ULIDRandom Source # | |
Defined in Data.ULID.Random | |
Data ULIDRandom Source # | |
Defined in Data.ULID.Random Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ULIDRandom -> c ULIDRandom # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ULIDRandom # toConstr :: ULIDRandom -> Constr # dataTypeOf :: ULIDRandom -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ULIDRandom) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ULIDRandom) # gmapT :: (forall b. Data b => b -> b) -> ULIDRandom -> ULIDRandom # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ULIDRandom -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ULIDRandom -> r # gmapQ :: (forall d. Data d => d -> u) -> ULIDRandom -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ULIDRandom -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ULIDRandom -> m ULIDRandom # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ULIDRandom -> m ULIDRandom # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ULIDRandom -> m ULIDRandom # | |
Read ULIDRandom Source # | |
Defined in Data.ULID.Random Methods readsPrec :: Int -> ReadS ULIDRandom # readList :: ReadS [ULIDRandom] # readPrec :: ReadPrec ULIDRandom # readListPrec :: ReadPrec [ULIDRandom] # | |
Show ULIDRandom Source # | |
Defined in Data.ULID.Random Methods showsPrec :: Int -> ULIDRandom -> ShowS # show :: ULIDRandom -> String # showList :: [ULIDRandom] -> ShowS # | |
Generic ULIDRandom Source # | |
Defined in Data.ULID.Random Associated Types type Rep ULIDRandom :: Type -> Type # | |
Binary ULIDRandom Source # | |
Defined in Data.ULID.Random | |
NFData ULIDRandom Source # | |
Defined in Data.ULID.Random Methods rnf :: ULIDRandom -> () # | |
type Rep ULIDRandom Source # | |
Defined in Data.ULID.Random type Rep ULIDRandom = D1 ('MetaData "ULIDRandom" "Data.ULID.Random" "ulid-0.3.2.0-BcOZlFVsiMK2FGyhpAn5jU" 'True) (C1 ('MetaCons "ULIDRandom" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
mkCryptoULIDRandom :: CryptoRandomGen g => g -> Either GenError (ULIDRandom, g) Source #
Generate a ULIDRandom
based on a cryptographically secure
random number generator.
See:
https://hackage.haskell.org/package/crypto-api-0.13.3/docs/Crypto-Random.html
mkULIDRandom :: RandomGen g => g -> (ULIDRandom, g) Source #
Generate a ULIDRandom
based on a standard random number generator.
See:
https://hackage.haskell.org/package/random-1.1/docs/System-Random.html
getULIDRandom :: IO ULIDRandom Source #
Note: The call to newStdGen
splits the generator,
so this is safe to call multiple times
Generate a ULID Random based on the global random number generator.