!V      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"(c) The University of Glasgow 2001;BSD-style (see the file LICENSE in the 'random' repository)libraries@haskell.orgstable Trustworthy 8=>?@ACFHMSVXj:randomVThe class of types for which a uniformly distributed value can be drawn from a range.randomGenerates a value uniformly distributed over the provided range, which is interpreted as inclusive in the lower and upper bound.uniformRM (1 :: Int, 4 :: Int). generates values uniformly from the set  \{1,2,3,4\}"uniformRM (1 :: Float, 4 :: Float). generates values uniformly from the set \{x\;|\;1 \le x \le 4\}BThe following law should hold to make the function always defined: #uniformRM (a, b) = uniformRM (b, a)randomnThe class of types for which a uniformly distributed value can be drawn from all possible values of the type.randomOGenerates a value uniformly distributed over all possible values of that type.random,The standard pseudo-random number generator.randomfWrapper for pure state gen, which acts as an immutable seed for the corresponding stateful generator randomQOpaque data type that carries the type of a pure pseudo-random number generator. randomThis class is designed for stateful pseudo-random number generators that can be saved as and restored from an immutable data type. randomIRepresents the state of the pseudo-random number generator for use with   and  . randomGSaves the state of the pseudo-random number generator as a frozen seed. randomARestores the pseudo-random number generator from its frozen seed.random< is an interface to monadic pseudo-random number generators.randomuniformWord32R upperBound g generates a / that is uniformly distributed over the range [0, upperBound].randomuniformWord64R upperBound g generates a / that is uniformly distributed over the range [0, upperBound].random Generates a / that is uniformly distributed over the entire  range.&The default implementation extracts a  from .random Generates a 0 that is uniformly distributed over the entire  range.&The default implementation extracts a  from .random Generates a 0 that is uniformly distributed over the entire  range.&The default implementation extracts a  from .random Generates a 0 that is uniformly distributed over the entire  range.(The default implementation combines two  from  into one .randomuniformShortByteString n g generates a  of length n" filled with pseudo-random bytes.random9 is an interface to pure pseudo-random number generators. is the standard # instance provided by this library.random Returns an ; that is uniformly distributed over the range returned by 9 (including both end points), and a new generator. Using * is inefficient as all operations go via . See  =https://alexey.kuleshevi.ch/blog/2019/12/21/random-benchmarkshere* for more details. It is thus deprecated.random Returns a / that is uniformly distributed over the entire  range.random Returns a / that is uniformly distributed over the entire  range.random Returns a / that is uniformly distributed over the entire  range.random Returns a / that is uniformly distributed over the entire  range.randomgenWord32R upperBound g returns a / that is uniformly distributed over the range [0, upperBound].randomgenWord64R upperBound g returns a / that is uniformly distributed over the range [0, upperBound].randomgenShortByteString n g returns a  of length n" filled with pseudo-random bytes.random'Yields the range of values returned by .It is required that:If  (a, b) =  g, then a < b.b must not examine its argument so the value it returns is determined only by the instance of ./The default definition spans the full range of . random5Returns two distinct pseudo-random number generators.Implementations should take care to ensure that the resulting generators are not correlated. Some pseudo-random number generators are not splittable. In that case, the  0 implementation should fail with a descriptive  message.!randomZEfficiently generates a sequence of pseudo-random bytes in a platform independent manner."randomSame as !, but runs in .#randomGenerates a pseudo-random  of the specified size.randomSplits a pseudo-random number generator into two. Updates the state with one of the resulting generators and returns the other.$random(Runs a monadic generating action in the 4 monad using a pure pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137,runStateGen pureGen randomM :: (Int, StdGen)X(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})%random(Runs a monadic generating action in the e monad using a pure pseudo-random number generator. Returns only the resulting pseudo-random value.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137$runStateGen_ pureGen randomM :: Int7879794327570578227&random(Runs a monadic generating action in the 4 monad using a pure pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 1370runStateGenT pureGen randomM :: IO (Int, StdGen)X(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})'random(Runs a monadic generating action in the e monad using a pure pseudo-random number generator. Returns only the resulting pseudo-random value.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137'runStateGenT_ pureGen randomM :: IO Int7879794327570578227(random(Runs a monadic generating action in the 4 monad using a pure pseudo-random number generator.)random Constructs a  deterministically.*random Generates uniformly distributed  in the range [0, 1]1. Numbers are generated by generating uniform  and dividing it by 2^{64}. It's used to implement UniformR instance for .+random Generates uniformly distributed  in the range (0, 1]. Number is generated as )2^{-64}/2+\operatorname{uniformDouble01M}N. Constant is 1/2 of smallest nonzero value which could be generated by *.,random Generates uniformly distributed  in the range [0, 1]1. Numbers are generated by generating uniform  and dividing it by 2^{32}. It's used to implement UniformR instance for -random Generates uniformly distributed  in the range (0, 1]. Number is generated as (2^{-32}/2+\operatorname{uniformFloat01M}N. Constant is 1/2 of smallest nonzero value which could be generated by ,.random"Generate an integral in the range [l, h] if l <= h and [h, l] otherwise.random"Generate an integral in the range [0, s)4 using a variant of Lemire's multiplication method.~Daniel Lemire. 2019. Fast Random Integer Generation in an Interval. In ACM Transactions on Modeling and Computer Simulation https://doi.org/10.1145/3230636PRECONDITION (unchecked): s > 0randomintegralWordSize i returns that least w such that i <= WORD_SIZE_IN_BITS^w.randomuniformIntegralWords n5 is a uniformly pseudo-random integral in the range [0, WORD_SIZE_IN_BITS^n).randomUniformly generate an ! in an inclusive-inclusive range.:Only use for integrals size less than or equal to that of .randomUniformly generate Word32 in [0, s].randomSee  $https://arxiv.org/pdf/1805.10941.pdfLemire's paper,  3https://www.pcg-random.org/posts/bounded-rands.htmlO'Neill's blogpost and more directly  hhttps://github.com/imneme/bounded-rands/blob/3d71f53c975b1e5b29f2f3b05a74e26dab9c3d84/bounded32.cpp#L234O'Neill's github repo). N.B. The range is [0,r) **not** [0,r].random&This only works for unsigned integralsrandombThis works for signed integrals by explicit conversion to unsigned and abusing overflow. It uses L, therefore it requires functions that take the value to unsigned and back.randomSDetailed explanation about the algorithm employed here can be found in this post: ]http://web.archive.org/web/20200520071940/https://www.pcg-random.org/posts/bounded-rands.htmlrandomSee  %System-Random-Stateful.html#fpcaveatsFloating point number caveats.randomSee  %System-Random-Stateful.html#fpcaveatsFloating point number caveats.randomSee  %System-Random-Stateful.html#fpcaveatsFloating point number caveats.randomSee  %System-Random-Stateful.html#fpcaveatsFloating point number caveats.!randomNumber of bytes to generaterandom4IO action that can generate 8 random bytes at a timerandomConvert signed to unsigned. a and b must be of the same size.randomConvert unsigned to signed. a and b must be of the same size.randomRange.random Generator.1  !"#$%&'()*+,-"(c) The University of Glasgow 2001;BSD-style (see the file LICENSE in the 'random' repository)libraries@haskell.orgstable Trustworthy8$.randomLThe class of types for which uniformly distributed values can be generated..w exists primarily for backwards compatibility with version 1.1 of this library. In new code, use the better specified  and  instead./randomTakes a range (lo,hi)' and a pseudo-random number generator gT, and returns a pseudo-random value uniformly distributed over the closed interval [lo,hi]D, together with a new generator. It is unspecified what happens if lo>hi@. For continuous types there is no requirement that the values lo and hiW are ever produced, but they may be, depending on the implementation and the interval.0random The same as /3, but using a default range determined by the type: For bounded types (instances of  , such as +), the range is normally the whole type.FFor fractional types, the range is normally the semi-closed interval [0,1).For *, the range is (arbitrarily) the range of .1randomPlural variant of /[, producing an infinite list of pseudo-random values instead of returning a new generator.2randomPlural variant of 0[, producing an infinite list of pseudo-random values instead of returning a new generator.3randomOGenerates a value uniformly distributed over all possible values of that type.This is a pure version of .Examplesimport System.Randomlet pureGen = mkStdGen 137!uniform pureGen :: (Bool, StdGen)I(True,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})4randomGenerates a value uniformly distributed over the provided range, which is interpreted as inclusive in the lower and upper bound.uniformR (1 :: Int, 4 :: Int). generates values uniformly from the set  \{1,2,3,4\}!uniformR (1 :: Float, 4 :: Float). generates values uniformly from the set \{x\;|\;1 \le x \le 4\}BThe following law should hold to make the function always defined: !uniformR (a, b) = uniformR (b, a)This is a pure version of .Examplesimport System.Randomlet pureGen = mkStdGen 137%uniformR (1 :: Int, 4 :: Int) pureGenF(4,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})5random Generates a I of the specified size using a pure pseudo-random number generator. See uniformByteString for the monadic version.Examplesimport System.Randomimport Data.ByteStringlet pureGen = mkStdGen 137)unpack . fst . genByteString 10 $ pureGen![51,123,251,37,49,167,90,109,1,4]random<Produce an infinite list-equivalent of pseudo-random values.Examplesimport System.Randomlet pureGen = mkStdGen 1375(take 4 . buildRandoms (:) random $ pureGen) :: [Int]R[7879794327570578227,6883935014316540929,-1519291874655152001,2353271688382626589]6random/Sets the global pseudo-random number generator.7random/Gets the global pseudo-random number generator.8randomApplies  k to the current global pseudo-random generator, updates it with one of the results, and returns the other.9randomUses the supplied function to get a value from the current global random generator, and updates the global generator with the new generator returned by the function. For example, rollDice. gets a pseudo-random integer between 1 and 6: < rollDice :: IO Int rollDice = getStdRandom (randomR (1,6)):random A variant of /6 that uses the global pseudo-random number generator.;random A variant of 06 that uses the global pseudo-random number generator.random E.g. '(:)' but subject to fusionrandomE.g. 0randomA  instance )./0123456789:; 345./012)9768;:"(c) The University of Glasgow 2001;BSD-style (see the file LICENSE in the 'random' repository)libraries@haskell.orgstable Trustworthy=?@ACHMSVX`randomFrozen version of mutable c generatorcrandom Wraps an 2 that holds a pure pseudo-random number generator.c< is safe in the presence of exceptions, but not concurrency.c is slower than & due to the extra pointer indirection.frandomFrozen version of mutable i generatorirandom Wraps an 2 that holds a pure pseudo-random number generator.i< is safe in the presence of exceptions, but not concurrency.i is slower than & due to the extra pointer indirection.i is faster than o since the  operations used by i are not atomic.?An example use case is writing pseudo-random bytes into a file:.import UnliftIO.Temporary (withSystemTempFile) import Data.ByteString (hPutStr)ulet ioGen g = withSystemTempFile "foo.bin" $ \_ h -> uniformRM (0, 100) g >>= flip uniformByteStringM g >>= hPutStr hand then run it:#newIOGenM (mkStdGen 1729) >>= ioGenlrandomFrozen version of mutable o generatororandom Wraps an \ that holds a pure pseudo-random number generator. All operations are performed atomically.o7 is safe in the presence of exceptions and concurrency.oZ is the slowest of the monadic adapters due to the overhead of its atomic operations.rrandomInterface to operations on  wrappers like i and .trandomSplits a pseudo-random number generator into two. Overwrites the mutable wrapper with one of the resulting generators and returns the other.urandom7Runs a mutable pseudo-random number generator from its Frozen state.Examplesimport Data.Int (Int8)SwithMutableGen (IOGen (mkStdGen 217)) (uniformListM 5) :: IO ([Int8], IOGen StdGen)h([-74,37,-50,-2,3],IOGen {unIOGen = StdGen {unStdGen = SMGen 4273268533320920145 15251669095119325999}})vrandomSame as u', but only returns the generated value.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137@withMutableGen_ (IOGen pureGen) (uniformRM (1 :: Int, 6 :: Int))4wrandom)Generates a list of pseudo-random values.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137g <- newIOGenM pureGenuniformListM 10 g :: IO [Bool]7[True,True,True,True,False,True,True,False,False,False]xrandom<Generates a pseudo-random value using monadic interface and . instance.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137g <- newIOGenM pureGenrandomM g :: IO Double0.5728354935654512yrandom<Generates a pseudo-random value using monadic interface and . instance.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137g <- newIOGenM pureGenrandomRM (1, 100) g :: IO Int52zrandomCreates a new o.{randomSAtomically applies a pure operation to the wrapped pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137g <- newAtomicGenM pureGen!applyAtomicGen random g :: IO Int7879794327570578227|randomCreates a new i.}randomGApplies a pure operation to the wrapped pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137g <- newIOGenM pureGenapplyIOGen random g :: IO Int7879794327570578227~randomCreates a new c.randomGApplies a pure operation to the wrapped pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137?(runSTGen pureGen (\g -> applySTGen random g)) :: (Int, StdGen)X(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})random(Runs a monadic generating action in the 4 monad using a pure pseudo-random number generator.Examplesimport System.Random.Statefullet pureGen = mkStdGen 137?(runSTGen pureGen (\g -> applySTGen random g)) :: (Int, StdGen)X(7879794327570578227,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})random(Runs a monadic generating action in the e monad using a pure pseudo-random number generator. Returns only the resulting pseudo-random value.Examplesimport System.Random.Statefullet pureGen = mkStdGen 1376(runSTGen_ pureGen (\g -> applySTGen random g)) :: Int7879794327570578227^  !"#$%&'()*+,-./0123456789:;`abcdefghijklmnopqrstuvwxyz{|}~C rsuvxyt $%&'(lmnopqz{fghijk|}`abcde~w!"#*+,-        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abbcddeffghhijjkllmnopqrstuvwxyz{|}~#random-1.2.0-LnDDzBF43Mx1KE2yrv9Wtf System.RandomSystem.Random.StatefulSystem.Random.InternaluniformM uniformRM UniformRangeUniformStdGenStateGen unStateGen StateGenM FrozenGen MutableGen freezeGenthawGen StatefulGenuniformWord32RuniformWord64R uniformWord8 uniformWord16 uniformWord32 uniformWord64uniformShortByteString RandomGennextgenWord8 genWord16 genWord32 genWord64 genWord32R genWord64RgenShortByteStringgenRangesplitgenShortByteStringIOgenShortByteStringSTuniformByteStringM runStateGen runStateGen_ runStateGenT runStateGenT_ runStateGenSTmkStdGenuniformDouble01MuniformDoublePositive01MuniformFloat01MuniformFloatPositive01MRandomrandomRrandomrandomRsrandomsuniformuniformR genByteString setStdGen getStdGen newStdGen getStdRandom randomRIOrandomIO $fRandomFloat$fRandomDouble $fRandomBool $fRandomChar$fRandomCDouble$fRandomCFloat$fRandomCUIntMax$fRandomCIntMax$fRandomCUIntPtr$fRandomCIntPtr$fRandomCULLong$fRandomCLLong$fRandomCSigAtomic$fRandomCWchar $fRandomCSize$fRandomCPtrdiff$fRandomCULong $fRandomCLong $fRandomCUInt $fRandomCInt$fRandomCUShort$fRandomCShort$fRandomCUChar$fRandomCSChar $fRandomCChar$fRandomWord64$fRandomWord32$fRandomWord16 $fRandomWord8 $fRandomWord $fRandomInt $fRandomInt64 $fRandomInt32 $fRandomInt16 $fRandomInt8$fRandomIntegerSTGenunSTGenSTGenMunSTGenMIOGenunIOGenIOGenMunIOGenM AtomicGen unAtomicGen AtomicGenM unAtomicGenM RandomGenMapplyRandomGenM splitGenMwithMutableGenwithMutableGen_ uniformListMrandomMrandomRM newAtomicGenMapplyAtomicGen newIOGenM applyIOGen newSTGenM applySTGenrunSTGen runSTGen_$fRandomGenMStateGenMrm$fStatefulGenAtomicGenMm$fRandomGenMAtomicGenMrm$fFrozenGenAtomicGenm$fStatefulGenIOGenMm$fRandomGenMIOGenMrm$fFrozenGenIOGenm$fStatefulGenSTGenMST$fRandomGenMSTGenMrST$fFrozenGenSTGenST $fEqAtomicGen$fOrdAtomicGen$fShowAtomicGen$fRandomGenAtomicGen$fStorableAtomicGen$fNFDataAtomicGen $fEqIOGen $fOrdIOGen $fShowIOGen$fRandomGenIOGen$fStorableIOGen $fNFDataIOGen $fEqSTGen $fOrdSTGen $fShowSTGen$fRandomGenSTGen$fStorableSTGen $fNFDataSTGenbaseGHC.WordWord32Word64Word8Word16bytestring-0.10.8.2Data.ByteString.Short.InternalShortByteStringghc-prim GHC.TypesInt integer-gmpGHC.Integer.TypeIntegerGHC.ErrerrorGHC.STSTData.ByteString.Internal ByteStringsplitGentransformers-0.5.5.0 Control.Monad.Trans.State.StrictStateStateTDoubleFloatuniformIntegralMboundedExclusiveIntegralMintegralWordSizeuniformIntegralWordsunbiasedWordMult32RMGHC.RealIntegralunbiasedWordMult32unbiasedWordMult32ExclusiveunsignedBitmaskWithRejectionRMsignedBitmaskWithRejectionRMunsignedBitmaskWithRejectionM$fUniformRangeFloat$fUniformRangeDouble$fUniformRangeCDouble$fUniformRangeCFloatunStdGenGHC.EnumBoundedChar buildRandoms GHC.STRefSTRef GHC.IORefIORef