ú΂.N'      !"#$%&None+3JKŸA random number generator. Either a fast, insecure mersenne twister or a secure one, depending on which smart constructor is used to construct this type.(Create a random number generator from a '= seed. This uses the insecure (but fast) mersenne twister.žCreate a new random number generator, using the clocktime as the base for the seed. This must be called from a computation with a lifted base effect of (.4This is just a conveniently seeded mersenne twister.ÞCreates a new random number generator, using the system entropy source as a seed. The random number generator returned from this function is cryptographically secure, but not nearly as fast as the one returned by  and .IUse a non-random effect as the Random source for running a random effect. IRuns an effectful random computation, returning the computation's result.)#Securely generate some random bits.*kA generalized form of generating a random number of the correct type from System.Random.Mersenne.Pure64.+, -)*   ,+ -)*None +234JKM" ÐContains a sorted list of cumulative probabilities, so we can do a sample by generating a uniformly distributed random number in the range [0, 1), and binary searching the vector for where to put it. =Yields a set of random from the internal generator, using  internally. :Returns a list of bits which have been randomly generated..*Returns the maximum set bit in an integer./.Repeat a computation until it succeeds a test.0Implementation of ~, with shared calculations with other uniformIntDists passed as parameters. This lets us share work with other calls to  with the same parameters.3Returns a number in the inclusive range [0, range].numBits is the number of bits in range.QGenerates a uniformly distributed random number in the inclusive range [a, b].QGenerates a uniformly distributed random number in the inclusive range [a, b].$This function is more flexible than Q since it relaxes type constraints, but passing in constant bounds such as uniformIntegralDist 0 10 will warn with -Wall.1 The part of > that does all the work. We factor it out so we can inline 1, and possibly share as much work as possible.GGenerates a uniformly distributed random number in the range [a, b).ÿ!NOTE: This code might not be correct, in that the returned value may not be perfectly uniformly distributed. If you know how to make one of these a better way, PLEASE send me a pull request. I just stole this implementation from the C++11  random header.<Generates a linearly-distributed random number in the range [a, b); aE with a probability of 0. This code is not guaranteed to be correct.2"Samples a continuous distribution.NGenerates random numbers as if they were sampled by the given distribution.8This is implemented with the inverse transform rule:  7http://en.wikipedia.org/wiki/Inverse_transform_sampling.DProduces random boolean values, according to a discrete probability.k must be in the range [0, 1].‚The value obtained is the number of successes in a sequence of t yes/no experiments, each of which succeeds with probability p.0t must be >= 0 p must be in the range [0, 1]. The value represents the number of failures in a series of independent yes/no trials (each succeeds with probability p), before exactly k successes occur./p must be in the range (0, 1] k must be >= 0Warning: NOT IMPLEMENTED!‹The value represents the number of yes/no trials (each succeeding with probability p) which are necessary to obtain a single success., p is equivalent to negativeBinomialDist 1 pp must be in the range (0, 1]Warning: NOT IMPLEMENTED!ÊThe value obtained is the probability of exactly i occurrences of a random event if the expected, mean number of its occurrence under the same conditions (on the same time/space interval) is ¼.Warning: NOT IMPLEMENTED!ÿ&The value obtained is the time/distance until the next random event if random events occur at constant rate » per unit of time/distance. For example, this distribution describes the time between the clicks of a Geiger counter or the distance between point mutations in a DNA strand.&This is the continuous counterpart of .•For floating-point ±, the value obtained is the sum of ± independent exponentially distributed random variables, each of which has a mean of ².‹Generates random numbers as sampled from a Weibull distribution. It was originally identified to describe particle size distribution.???Warning: NOT IMPLEMENTED!DGenerates random numbers as sampled from the normal distribution.›Generates a log-normally distributed random number. This is based off of sampling the normal distribution, and then following the instructions at  hhttp://en.wikipedia.org/wiki/Log-normal_distribution#Generating_log-normally_distributed_random_variates.37Share this computation over every call of lognormalDist@Produces random numbers according to a chi-squared distribution.HProduced random numbers according to a Cauchy (or Lorentz) distribution.7Produces random numbers according to an F-distribution.#m and n are the degrees of freedom. ÿeThis distribution is used when estimating the mean of an unknown normally distributed value given n+1 independent measurements, each with additive errors of unknown standard deviation, as in physical measurements. Or, alternatively, when estimating the unknown mean of a normal distribution with unknown standard deviation, given n+1 samples.!JPerforms O(n) work building a table which we can later use sample with "."Given a pre-build   (use !Ò), produces random integers on the interval [0, n), where the probability of each individual integer i is defined as w_i/S, that is the weight of the ith integer divided by the sum of all n weights.xi.e. This function produces an integer with probability equal to the weight given in its index into the parameter to !.#ÿThis function produces random floating-point numbers, which are uniformly distributed within each of the several subintervals [b_i, b_(i+1)), each with its own weight w_i. The set of interval boundaries and the set of weights are the parameters of this distribution. For example, ]piecewiseConstantDist [ 0, 1, 10, 15 ] (buildDDH [ 1, 0, 1 ])r will produce values between 0 and 1 half the time, and values between 10 and 15 the other half of the time.$ÿ1This function produces random floating-point numbers, which are distributed with linearly-increasing probability within each of the several subintervals [b_i, b_(i+1)), each with its own weight w_i. The set of interval boundaries and the set of weights are the parameters of this distribution.ÜFor example, `piecewiseLinearDist [ 0, 1, 10, 15 ] (buildDDH [ 1, 0, 1 ])` will produce values between 0 and 1 half the time, and values between 10 and 15 the other half of the time.%Shuffle a mutable vector.&Shuffle an immutable vector.' 4 The number of bits to generate./560rangenumBitsabab1arangeab2The distribution to sample.0k: The fraction of results which should be true.tppkp¼i». Scale parameter.±. The shape parameter.². The scale parameter.±. The shape parameter.². The scale parameter.±. The shape parameter.². The scale parameter. ¼. The mean.Ã. The standard deviation. ¼. The mean.Ã. The standard deviation.3$n. The number of degrees of freedom. Central point)Scale parameter (full width half maximum)mn  The number of degrees of freedom!"7# IntervalsWeights$ IntervalsWeights%&'  !"#$%&'  !"#$&% & 4 ./560123 !"7#$%&8      !"#$%&'()*+,-./0123456789:;<=>?system-random-effect-0.4.1.3System.Random.EffectSystem.Random.Effect.RawRandom randomInt randomWord randomInt64 randomWord64mkRandom mkRandomIOmkSecureRandomIO forRandEffrunRandomStateDiscreteDistributionHelper randomDouble randomBits randomBitListuniformIntDistuniformIntegralDistuniformRealDistlinearRealDist bernoulliDist binomialDistnegativeBinomialDist geometricDist poissonDistexponentialDist gammaDist weibullDistextremeValueDist normalDist lognormalDistchiSquaredDist cauchyDist fisherFDist studentTDistbuildDDH discreteDistpiecewiseConstantDistpiecewiseLinearDist knuthShuffleM knuthShufflebaseGHC.WordWord64ghc-prim GHC.TypesIO srandomBitsrandomF SecureRandom FastRandomfoldBitsmaxBit loopUntiluniformIntDist'uniformRealDist'sampleContDistsimpleNDDDHb2i bitsToInteger piecewiseDist