Name

intprb_shragerandom — A portable random number generator by Schrage.

Calling Sequence

   [ value, seed ] = intprb_shragerandom ( seed )
   
   

Parameters

seed :

a 1x1 matrix of floating point integers, a seed for the random number generator. The seed must be a positive, nonzero floating point integer less than 2147483647.

value :

1x1 matrix of doubles, a pseudorandom value.

Description

This is a portable random number generator by Schrage. The generator is based on the multiplicative congruential generator X = A * X (mod M) with A = 16807 and M = 2^31 - 1 = 2147483647. Schrage states that the generator is full cycle, with period M. The implementation may be slower than Park and Miller's "Good ones are hard to find". Genz uses the seed = 123456.

This function is used in Genz's problem, for the computation of the parameters of the function.

Examples

seed = 1
for i = 1 : 1000
[ value, seed ] = intprb_shragerandom ( seed );
end
// Must be : seed = 522329230
mprintf("seed = %d",seed)

   

Authors

1979 - Linus Schrage
2007 - John Burkardt (MATLAB version)
2010 - Michael Baudin (Scilab version)

Bibliography

"A More Portable Fortran Random Number Generator", Linus Schrage, ACM Transactions on Mathematical Software, Volume 5, Number 2, June 1979, pages 132-138.

"A pseudo-random number generator for the system/360", Lewis, P A W, Goodman, A.S., And Miller, J M . IBM Syst. 3". 8, 2 (1969), 136-146.