Ran |
Ran000: minimal congruential
Returns integer random numbers uniformly distributed within [0,2147483646].
NOT RECOMENDED FOR SERIOUS APPLICATIONS.
public class Ran000 : RandomGenerator
The Ran000 type exposes the following members.
| Name | Description | |
|---|---|---|
| Ran000 | Initializes a new instance of the Ran000 class | |
| Ran000(UInt32) | Initializes a new instance of the Ran000 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) |
Notes: - NOT RECOMENDED FOR SERIOUS APPLICATIONS.
Just use it for comparison purposes, etc.
- This generator is fast
- "Minimal" random number generator of Park and Miller.
x(n) = 16807 * x(n-1) mod (2^31-1)
also known as GGL.
- Set seed to any integer value (except the unlikely value mask) to
initialize the sequence.
- The period is 2^31-2 = 2.1*10^9. If your application needs
more numbers in sequence than 1% of the random generators period,
i.e. 10^7, then use a more elaborate random generator.
- At least 32 bit long int is required.
- References:
o Algorithm from CACM 31 no. 10, pp. 1192-1201, October 1988.
o Algorithm "ran0" from "Portable Random Number Generators",
William H. Press and Saul A Teukolsky
Computers in Phyics, Vol. 6, No. 5, Sep/Oct 1992
o According to a posting by Ed Taft on comp.lang.postscript,
Level 2 (Adobe) PostScript interpreters use this algorithm too.
----------------------------------------------------------------------------