pdk.Math.RandomNumbers ($Date: 2002/12/04 10:16:02 $)
index
pdk/Math/RandomNumbers.py

Routines for generating random numbers.

FOG 11.1999

 
Classes
            
_RandomNumbers
 
class _RandomNumbers
     
Purpose:custom class for accessing the Random Number Generator (RNG)

 
   Methods defined here:
__init__(self)
choice(self, a)
returns a random element from the sequence a.
circPar(self, mean, arc)
circular uniform random variable with mean angle mean and range arc (radian).
expPar(self, l)
exponentially distributed random variable with rate l = 1/mean.
normPar(self, mu, sigma)
Gaussian distributed random variable with parameters mean mu and stddev sigma.
normParSample(self, mu, sigma, n)
array of parameterized normal random numbers with mean mu and standard deviation sigma of shape n (a tuple).
normParSampleForced(self, mu, sigma, *n)
like .normParSample, but uses .normStdSampleForced rather than standard normally distributed numbers.
normStdSampleForced(self, n, epsilon=0.01)
experimental. Continues sampling until mean and variance of the sample deviate from 0 and 1 by less than or equal epsilon.
poissPar(self, l)
Poisson distributed random variable with mean l ; l must be > 0.
reset(self, seed_method='system', seed=None)
Parameters:
  • seed_method: determines the method with which the random number generator is initialized; possible values are:

    • "builtin": default built-in value used as seed.
    • "system": derive seed internally from the system clock
    • "direct": use a positive 32bit integer supplied in seed as seed. This is automatically chosen if a value for seed is passed.
    • "set": use a random seed (32bit) generated by a temporary instance of _RandomNumbers and reset with it. This way, the value for seed can be stored for later identical runs.
sign(self)
randomly returns 1 or -1.
uniform(self)
uniformIntRange(self, a, b)
random integer in [a,b].
uniformIntRangeSample(self, a, b, *n)
array of uniform random integers in [a,b] of shape n (a tuple)
uniformRange(self, a, b)
uniform random number in [a,b). Adapted from whrandom.py.
vonMisesPar(self, mu, kappa)
Von Mises random variable with mean angle mu (in radian) and concentration parameter kappa > 0. Adapted from random.py.

Data and non-method functions defined here:
seed = None
 
class _RandomNumbers
     
Purpose:custom class for accessing the Random Number Generator (RNG)

 
   Methods defined here:
__init__(self)
choice(self, a)
returns a random element from the sequence a.
circPar(self, mean, arc)
circular uniform random variable with mean angle mean and range arc (radian).
expPar(self, l)
exponentially distributed random variable with rate l = 1/mean.
normPar(self, mu, sigma)
Gaussian distributed random variable with parameters mean mu and stddev sigma.
normParSample(self, mu, sigma, n)
array of parameterized normal random numbers with mean mu and standard deviation sigma of shape n (a tuple).
normParSampleForced(self, mu, sigma, *n)
like .normParSample, but uses .normStdSampleForced rather than standard normally distributed numbers.
normStdSampleForced(self, n, epsilon=0.01)
experimental. Continues sampling until mean and variance of the sample deviate from 0 and 1 by less than or equal epsilon.
poissPar(self, l)
Poisson distributed random variable with mean l ; l must be > 0.
reset(self, seed_method='system', seed=None)
Parameters:
  • seed_method: determines the method with which the random number generator is initialized; possible values are:

    • "builtin": default built-in value used as seed.
    • "system": derive seed internally from the system clock
    • "direct": use a positive 32bit integer supplied in seed as seed. This is automatically chosen if a value for seed is passed.
    • "set": use a random seed (32bit) generated by a temporary instance of _RandomNumbers and reset with it. This way, the value for seed can be stored for later identical runs.
sign(self)
randomly returns 1 or -1.
uniform(self)
uniformIntRange(self, a, b)
random integer in [a,b].
uniformIntRangeSample(self, a, b, *n)
array of uniform random integers in [a,b] of shape n (a tuple)
uniformRange(self, a, b)
uniform random number in [a,b). Adapted from whrandom.py.
vonMisesPar(self, mu, kappa)
Von Mises random variable with mean angle mu (in radian) and concentration parameter kappa > 0. Adapted from random.py.

Data and non-method functions defined here:
seed = None
 
Functions
            
circ_par = circPar(self, mean, arc) method of _RandomNumbers instance
choice = choice(self, a) method of _RandomNumbers instance
exp_par = expPar(self, l) method of _RandomNumbers instance
norm_par = normPar(self, mu, sigma) method of _RandomNumbers instance
norm_par_sample = normParSample(self, mu, sigma, n) method of _RandomNumbers instance
norm_par_sample_forced = normParSampleForced(self, mu, sigma, *n) method of _RandomNumbers instance
poiss_par = poissPar(self, l) method of _RandomNumbers instance
reset_generator = reset(self, seed_method='system', seed=None) method of _RandomNumbers instance
sign = sign(self) method of _RandomNumbers instance
uniform_int_range = uniformIntRange(self, a, b) method of _RandomNumbers instance
uniform_int_range_sample = uniformIntRangeSample(self, a, b, *n) method of _RandomNumbers instance
uniform_range = uniformRange(self, a, b) method of _RandomNumbers instance
von_mises_par = vonMisesPar(self, mu, kappa) method of _RandomNumbers instance
 
Data
             random = instance of _RandomNumbers
 
Author
            
$Author: gathmann $