User Tools

Site Tools


gams:random_number_generator_in_gams

Random number generator in GAMS

GAMS has these random number generator functions:

  1. num = uniform(low,high): Uniform random number between Uniform(low,high)
  2. num = uniformint(low,high): Uniform integer random number between UniformInt(low,high)
  3. num = normal(mean,std): Random number from a normal distribution with a mean of mean and a standard deviation of std

The random numbers in GAMS are not truly random, they are pseudo-random, generated using a deterministic algorithm (called a generator) inside GAMS. If you want different random numbers on each run, you must reseed the generator.

You may use something like: execseed = 1 + gmillisec(jnow);

gams/random_number_generator_in_gams.txt · Last modified: 2013/01/16 15:13 by support