Méthode | Description | |
---|---|---|
Bool ( ) : bool |
Draw a random boolean with equal probability of true or false. Thread-safe if Uniform() is thread-safe.
|
|
Bool ( double p ) : bool |
Draw a random boolean with probability p of true and (1-p) of false. Thread-safe if Uniform() is thread-safe.
|
|
Byte ( ) : byte |
Draw a random and uniform byte. Thread-safe if Index() is thread-safe. The default implementation uses Index() which in turn uses Uniform(). This is quite expensive for generating just one byte, but is the most generally viable way of doing it for many PRNGs, because their low-order bits are not very random. Some PRNGs may offer much better ways of generating just a single random byte, in which case this method should of course be overrided. |
|
Bytes ( int length ) : byte[] |
Draw an array of random and uniform bytes. Thread-safe if Byte() is thread-safe.
|
|
Circle ( ) : double[] |
Generate a uniform random point from the unit-radius 2-dimensional circle. Thread-safe if Disk() is thread-safe.
|
|
Circle ( double &x, double &y ) : void |
Generate a uniform random point from the unit-radius 2-dimensional circle. Thread-safe if Disk() is thread-safe.
|
|
Disk ( ) : double[] |
Generate a uniform random point from the unit-radius 2-dimensional disk. Thread-safe if Uniform() is thread-safe.
|
|
Disk ( double &x, double &y, double &sumSquares ) : void |
Generate a uniform random point from the unit-radius 2-dimensional disk. Thread-safe if Uniform() is thread-safe.
|
|
Gauss ( ) : double |
Draw a Gaussian (or normally) distributed random number, with mean 0 and deviation 1. Not thread-safe.
|
|
Gauss ( double mean, double deviation ) : double |
Draw a Gaussian (or normally) distributed random number, with designated mean and deviation. Thread-safe if Gauss() is thread-safe.
|
|
Index ( double probabilities ) : int |
Draw a random integer from the set {0, .., n-1} according to the supplied probability distribution. Probabilities are assumed to sum to one. Time-complexity is O(n), where n is the length of the probabilities-array. Use this function if you only need to draw a few random numbers, otherwise create an IndexDistribution-object. Thread-safe if Uniform() is thread-safe.
|
|
Index ( int n ) : int |
Draw a random integer from the set {0, .., n-1} with uniform probability. Thread-safe if Uniform() is thread-safe. The default implementation uses Uniform() to generate an integer. This is because many PRNGs must use division instead of modulo arithmetics due to the lower-order bits having little randomness. Assume Uniform cannot generate an exact value of one, otherwise this must have been taken into account to ensure uniform probability of choosing the different indices. |
|
Index2 ( int n, int &index1, int &index2 ) : void |
Draw two distinct integers from the set {0, .., n-1} with equal probability. Thread-safe if Uniform() is thread-safe.
|
|
Sphere ( int n, double r ) : double[] |
Generate a uniform random point on the n-dimensional hypersphere. Thread-safe if Gauss() is thread-safe.
|
|
Sphere ( double &x, double r ) : void |
Generate a uniform random point on the n-dimensional hypersphere. Thread-safe if Gauss() is thread-safe, and each thread supplies its own array x.
|
|
Sphere3 ( ) : double[] |
Generate a uniform random point on the unit-radius 3-dimensional sphere. Thread-safe if Disk() is thread-safe.
|
|
Sphere3 ( double &x ) : void |
Generate a uniform random point on the unit-radius 3-dimensional sphere. Thread-safe if Disk() is thread-safe.
|
|
Sphere4 ( ) : double[] |
Generate a uniform random point on the unit-radius 4-dimensional sphere. Thread-safe if Disk() is thread-safe.
|
|
Sphere4 ( double &x ) : void |
Generate a uniform random point on the unit-radius 4-dimensional sphere. Thread-safe if Disk() is thread-safe.
|
|
Uniform ( ) : double |
Draw a uniform random number in the exclusive range (0,1). This must be implemented in every inherited class. It is important that it does not return the end-point values of zero or one, or else some of the methods which use Uniform() to generate their random numbers will not work. |
|
Uniform ( double low, double high ) : double |
Draw a uniform random number in the exclusive range (low,high). Thread-safe if Uniform() is thread-safe.
|
public Bytes ( int length ) : byte[] | ||
length | int | The array length requested. |
Résultat | byte[] |
public Circle ( double &x, double &y ) : void | ||
x | double | Random point x |
y | double | Random point y |
Résultat | void |
public Disk ( double &x, double &y, double &sumSquares ) : void | ||
x | double | Random point x |
y | double | Random point y |
sumSquares | double | Equals x*x + y*y |
Résultat | void |
public Gauss ( double mean, double deviation ) : double | ||
mean | double | The mean of the distribution, e.g. 0. |
deviation | double | The deviation of the distribution, e.g. 1. |
Résultat | double |
public Index ( double probabilities ) : int | ||
probabilities | double | Probability distribution. |
Résultat | int |
public Index2 ( int n, int &index1, int &index2 ) : void | ||
n | int | |
index1 | int | Reference to the first integer drawn. |
index2 | int | Reference to the second integer drawn. |
Résultat | void |
public Sphere ( int n, double r ) : double[] | ||
n | int | Dimensionality of hypersphere. |
r | double | Radius of hypersphere. |
Résultat | double[] |
public Sphere ( double &x, double r ) : void | ||
x | double | Array to hold the random point. |
r | double | Radius of hypersphere. |
Résultat | void |
public Sphere3 ( double &x ) : void | ||
x | double | Array to hold the random point. |
Résultat | void |
public Sphere4 ( double &x ) : void | ||
x | double | Array to hold the random point. |
Résultat | void |
public Uniform ( double low, double high ) : double | ||
low | double | The lowest value in the range. |
high | double | The highest value in the range. |
Résultat | double |