Ran |
public class Ran004 : RandomGenerator
The Ran004 type exposes the following members.
| Name | Description | |
|---|---|---|
| Ran004 | Initializes a new instance of the Ran004 class. | |
| Ran004(UInt32) | Initializes a new instance of the Ran004 class with a specified seed. |
| Name | Description | |
|---|---|---|
| Maximum | The maximum value of the random number which can be returned. (Inherited from RandomGenerator) | |
| Seed | Gets the current 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 | The generation function. (Overrides RandomGeneratorLong) | |
| Long(UInt32, UInt32) | Resets the sequence to a specified seed and position and returns that deviate. | |
| 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) |
The period length for one seed is 2^32, but the seed is incremented
automatically if the series for one seed is exhausted. There are
2^32 possible seeds.
Notes:
a) The original version of Ref. (1) is not portable to machines with larger
word lengths. That means different random sequences are obtained for
32-bit long integers and 64-bit long integers.
This version is made portable by using bit-masks. The run time penalty
is negligible.
b) The random sequence for one seed has only a period of maximally 2^32.
This is definitely too short for modern MC simulations. In this version
the seed is automatically incremented to jump to the next segment
when one segment is exhausted.
c) Also the extremely inconvenient interface of the original
has been changed.
Reference:
(1) W.H. Press, S.A. Teukolsky, Vetterling, Teukolsky,
Numerical Recipes in C, 2nd edition, 1992.
(2) Major modifications a) to c) and inclusion into Matpack
by B. M. Gammel, Apr 1, 1997 (no joke!)