omde.random
index
/usr/local/lib/python2.1/site-packages/omde/random.py

Pseudo random numbers.
 
The following random number generators are available:
 
UniformRandom
LinearRandom
InverseLinearRandom
TriangularRandom
InverseTriangularRandom
ExponentialRandom
InverseExponentialRandom
BilateralExponentialRandom
GaussRandom
CauchyRandom
BetaRandom
WeibullRandom
 
The random number generator exported by this module
are not designed to be correct from a statistic point
of view but useful from a musical point of view.
 
In particular some of these generators have been
modified to return values in the [0, 1] range
even if they have a tail outside this interval.
 
Other have been modified to be consistent with
the Cmask original RNGs.

 
Modules
            
math
time
whrandom

 
Classes
            
Brownian
omde.functional.Function(omde.functional.FunctionModel)
BetaRandom
BilateralExponentialRandom
CauchyRandom
ExponentialRandom
GaussRandom
InverseExponentialRandom
omde.functional.Generator
InverseLinearRandom
InverseTriangularRandom
LinearRandom
TriangularRandom
UniformRandom
WeibullRandom
_BetavariateRNG
_ExpovariateRNG
_GaussRNG
_LehmerRNG
_WeibullvariateRNG

 
class BetaRandom(omde.functional.Function)
      Random number function with beta distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, alpha=0.10000000000000001, beta=0.10000000000000001)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class BilateralExponentialRandom(omde.functional.Function)
      Random number function with bilateral exponential distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, lambd=1.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class Brownian
       
  
__call__(self)
__init__(self, min, max, scale)

 
class CauchyRandom(omde.functional.Function)
      Random number function with Cauchy distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, alpha=0.10000000000000001, mu=0.5)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class ExponentialRandom(omde.functional.Function)
      Random number function with exponential distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, lambd=1.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class GaussRandom(omde.functional.Function)
      Random number function with Gauss distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, mu=0.5, sigma=0.10000000000000001)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class InverseExponentialRandom(omde.functional.Function)
      Random number function with inverse exponential distribution
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, lambd=1.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class InverseLinearRandom(omde.functional.Generator)
      Random generator with linearly increasing distribution.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class InverseTriangularRandom(omde.functional.Generator)
      Random generator with inverse triangular distribution.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class LinearRandom(omde.functional.Generator)
      Random generator with linearly decreasing distribution.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class TriangularRandom(omde.functional.Generator)
      Random generator with triangular distribution.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class UniformRandom(omde.functional.Generator)
      Random generator with uniform distribution
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class WeibullRandom(omde.functional.Generator)
      Random number function with Weibull distribution
 
  
__add__(self, object) from omde.functional.Generator
__call__(self, t)
__div__(self, object) from omde.functional.Generator
__init__(self, alpha=0.5, beta=2.0)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class _BetavariateRNG
       
  
__init__(self)
random(self, alpha, beta)

 
class _ExpovariateRNG
       
  
__init__(self)
random(self, lambd)

 
class _GaussRNG
       
  
__init__(self)
random(self, mu, sigma)
When x and y are two variables from [0, 1), uniformly
distributed, then
 
cos(2*pi*x)*sqrt(-2*log(1-y))
sin(2*pi*x)*sqrt(-2*log(1-y))
 
are two *independent* variables with normal distribution
(mu = 0, sigma = 1).

 
class _LehmerRNG
      Linear-Congruential Random Number Generator.
 
Settings published in: 
http://www.taygeta.com/rwalks/node1.html, adapted from:
Park, S.K. and K.W. Miller, 1988; Random Number Generators: Good Ones 
are Hard to Find, Comm. of the ACM, V. 31. No. 10, pp 1192-1201.
 
Usage:
 
x = _LehmerRNG([seed, mod, mul, incr])
 
this returns a callable object. The optional keyword-arguments set the 
instance attributes. For seeding in relation to system time, seed may 
be set to 0 or may be omitted.
 
The defaults of the other arguments are 2147483647.0, 16807.0, 0.
These defaults can be changed only while the instance is created.
 
'seed' is a number between 1 and 2147483647.
 
  
__init__(self, seed=0, mod=2147483647.0, mul=16807.0, incr=0)
random(self)
Returns a uniform random number between 0 and 1
seed(self, seed=0)

 
class _WeibullvariateRNG
       
  
__init__(self)
random(self, alpha, beta)

 
Functions
            
UniformRNG = _AlwaysTheSame()
_AlwaysTheSame()

 
Data
             __file__ = '/usr/local/lib/python2.1/site-packages/omde/random.pyc'
__name__ = 'omde.random'
_the_same = <whrandom.whrandom instance>