Rand -package:MonadRandom

The GRand struct is an opaque data structure. It should only be accessed through the g_rand_* functions.
Memory-managed wrapper type.
pseudorandom matrix with uniform elements between 0 and 1
rand is an oscillator that generates a continuous pattern of (pseudo-)random numbers between 0 and 1. For example, to randomly pan around the stereo field:
d1 $ sound "bd*8" # pan rand
Or to enjoy a randomised speed from 0.5 to 1.5, add 0.5 to it:
d1 $ sound "arpy*4" # speed (rand + 0.5)
To make the snares randomly loud and quiet:
sound "sn sn ~ sn" # gain rand
Numbers coming from this pattern are 'seeded' by time. So if you reset time (using resetCycles, setCycle, or cps) the random pattern will emit the exact same _random_ numbers again. In cases where you need two different random patterns, you can shift one of them around to change the time from which the _random_ pattern is read, note the difference:
jux (# gain rand) $ sound "sn sn ~ sn" # gain rand
and with the juxed version shifted backwards for 1024 cycles:
jux (# ((1024 <~) $ gain rand)) $ sound "sn sn ~ sn" # gain rand
pseudorandom matrix with uniform elements between 0 and 1
Random seed used for generation of the test data
This library deals with the common task of pseudo-random number generation.
The class of types for which random values can be generated. Most instances of Random will produce values that are uniformly distributed on the full range, but for those types without a well-defined "full range" some sensible default subrange will be selected. Random exists primarily for backwards compatibility with version 1.1 of this library. In new code, use the better specified Uniform and UniformRange instead.
RandomGen is an interface to pure pseudo-random number generators. StdGen is the standard RandomGen instance provided by this library.
Deprecated: In favor of FrozenGen
PRNG services See http://www.openssl.org/docs/crypto/rand.html For random Integer generation, see OpenSSL.BN
This module is for instantiating cryptographicly strong determinitic random bit generators (DRBGs, aka PRNGs) For the simple use case of using the system random number generator (Entropy) to seed the DRBG:
g <- newGenIO
Users needing to provide their own entropy can call newGen directly
entropy <- getEntropy nrBytes
let generator = newGen entropy
Flexible modeling and sampling of random variables. The central abstraction in this library is the concept of a random variable. It is not fully formalized in the standard measure-theoretic language, but rather is informally defined as a "thing you can get random values out of". Different random variables may have different types of values they can return or the same types but different probabilities for each value they can return. The random values you get out of them are traditionally called "random variates". Most imperative-language random number libraries are all about obtaining and manipulating random variates. This one is about defining, manipulating and sampling random variables. Computationally, the distinction is small and mostly just a matter of perspective, but from a program design perspective it provides both a powerfully composable abstraction and a very useful separation of concerns. Abstract random variables as implemented by RVar are composable. They can be defined in a monadic / "imperative" style that amounts to manipulating variates, but with strict type-level isolation. Concrete random variables are also provided, but they do not compose as generically. The Distribution type class allows concrete random variables to "forget" their concreteness so that they can be composed. For examples of both, see the documentation for RVar and Distribution, as well as the code for any of the concrete distributions such as Uniform, Gamma, etc. Both abstract and concrete random variables can be sampled (despite the types GHCi may list for the functions) by the functions in Data.Random.Sample. Random variable sampling is done with regard to a generic basis of primitive random variables defined in Data.Random.Internal.Primitives. This basis is very low-level and the actual set of primitives is still fairly experimental, which is why it is in the "Internal" sub-heirarchy. User-defined variables should use the existing high-level variables such as Uniform and Normal rather than these basis variables. Data.Random.Source defines classes for entropy sources that provide implementations of these primitive variables. Several implementations are available in the Data.Random.Source.* modules.