Version 1.1.0
12th July 2004- User documentation
- Recent Changes
-
Code Download
- Single
- Double
HSL_FA14: Uniform distribution
This package generates uniformly distributed pseudo-random numbers. Random reals are generated in the range \(0 < \xi < 1\) or the range \(-1 < \eta < 1\) and random integers in the range \(1 \le k \le N\) where \(N\) is specified by the user.
A multiplicative congruent method is used where a 31 bit generator word \(g\) is maintained. On each call to a procedure of the package, \(g _n+1\) is updated to \(7 ^5 g _n \mathrm{mod} (2 ^{31} - 1)\); the initial value of \(g\) is \(2 ^{16} - 1\). Depending upon the type of random number required the following are computed \(\xi = g _{n+1} /(2 ^{31} - 1)\); \(\eta = 2 \xi - 1\) or \(k = \mathrm{ int.part }\{ \xi N \} +1\).
The package also provides the facility for saving the current value of the generator word and for restarting with any specified value.