Ran |
public class Ran013 : RandomGenerator
The Ran013 type exposes the following members.
Name | Description | |
---|---|---|
Ran013 | Initializes a new instance of the Ran013 class | |
Ran013(UInt32) | Initializes a new instance of the Ran013 class |
Name | Description | |
---|---|---|
Maximum | The maximum value of the random number which can be returned. (Inherited from RandomGenerator) | |
Seed | The seed value. (Inherited from RandomGenerator) |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
GetHashCode | Serves as the default hash function. (Inherited from Object) | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
Long | (Overrides RandomGeneratorLong) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
ToString | Returns a string that represents the current object. (Inherited from Object) |
Name | Description | |
---|---|---|
max_val | Uniform long int values within [0...max_val]. (Inherited from RandomGenerator) | |
seed | The seed of the random generator. (Inherited from RandomGenerator) |
- At least 32 bit long int is required, but works with any larger word lengths - Reference: This is algorithm "mzran13" from G. Marsaglia and A. Zaman, "Some portable very-long-period random number generators", Computers in Physics, Vol. 8, No. 1, Jan/Feb 1994. In the original implementation the algorithm relies on 32-bit arithmetics with implicit modulo 2^32 on overflow. Since the the size of unsigned longs may not always be 32 bit the modulo 2^32 is coded explicitly using masks. The performance loss is not very important. The original code reads: long s; if (y > x+c) { s = y - (x+c); c = 0; } else { s = y - (x+c) - 18; c = 1; } x = y; y = z; return ((z = s) + (n - 69069 * n + 1013904243)); ^ Here it contains a misprint Should really be a "=" !