random_option
Selects the uniform (0, 1) multiplicative congruential pseudorandom number generator or a generalized feedback shift register (GFSR) method.
Synopsis
#include <imsls.h>
void imsls_random_option (int generator_option)
Required Arguments
int generator_option (Input)
Indicator of the generator. Argument generator_option is used to choose the multiplier and whether or not shuffling is done, or the GFSR method.
generator_option
Generator
1
The multiplier 16807 is used.
2
The multiplier 16807 is used with shuffling.
3
The multiplier 397204094 is used.
4
The multiplier 397204094 is used with shuffling.
5
The multiplier 950706376 is used.
6
The multiplier 950706376 is used with shuffling.
7
GFSR, with the recursion Xt = Xt−1563 Xt−96 is used.
8
A 32-bit Mersenne Twister generator is used. The float and double random numbers are generated from 32-bit integers.
9
A 64-bit Mersenne Twister generator is used. The float and double random numbers are generated from 64-bit integers. This ensures that all bits of both float and doubles are random.
Description
The uniform pseudorandom number generators use a multiplicative congruential method, with or without shuffling. The value of the multiplier and whether or not to use shuffling are determined by imsls_random_option. The description of function imsls_f_random_uniform may provide some guidance in the choice of the form of the generator. If no selection is made explicitly, the generators use the multiplier 16807 without shuffling. This form of the generator has been in use for some time (see Lewis et al. 1969).
Both of the Mersenne Twister generators have a period of 219937-1 and a 623-dimensional equidistribution property. See Matsumoto et al. 1998 for details.
The IMSL Mersenne Twister generators are derived from code copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved. It is subject to the following notice:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The IMSL 32-bit Mersenne Twister generator is based on the Matsumoto and Nishimura code ‘mt19937ar’ and the 64-bit code is based on ‘mt19937-64’.
Example