Initialization
-
gsl_rng_set(name)
Set the random number generator used by all the random
functions. To set the random seed use the AMPL option
randseed
. E.g.:
call gsl_rng_set('taus2');
option randseed 781206;
print gsl_ran_gaussian(1);
Must be a valid gsl generator name, listed here:
borosh13, cmrg, coveyou, fishman18, fishman20, fishman2x,
gfsr4, knuthran, knuthran2, knuthran2002, lecuyer21,
minstd, mrg, mt19937, mt19937_1999, mt19937_1998,
r250, ran0, ran1, ran2, ran3, rand,
rand48, random128-bsd, random128-glibc2, random128-libc5
random256-bsd, random256-glibc2, random256-libc5,
random32-bsd, random32-glibc2, random32-libc5, random64-bsd,
random64-glibc2, random64-libc5, random8-bsd, random8-glibc2,
random8-libc5, random-bsd, random-glibc2, random-libc5,
randu, ranf, ranlux, ranlux389, ranlxd1, ranlxd2,
ranlxs0, ranlxs1, ranlxs2, ranmar, slatec, taus,
taus2, taus113, transputer, tt800, uni, uni32
vax, waterman14, zuf
Example
The following example shows how to select a random number generator and
initialize the seed.
include gsl.ampl;
call gsl_rng_set('taus');
option randseed 781206;
print gsl_ran_gaussian(1);