DEFINITIONS
 /* LibraryRandom.def */
 
 // generate uniformly distributed random numbers between lower (included) and upper value (not included)
 EXTERNAL_FUNCTION_RANDOM == INTEGER*INTEGER --> INTEGER;
 RANDOM(rnd_low,rnd_up) == rnd_low;
 
 // choose a random element from a set
 random_element(x) == max(x);
 EXTERNAL_FUNCTION_random_element(RANDOM_TYPE) == POW(RANDOM_TYPE) --> RANDOM_TYPE;
 
 // choose a random subset from a set
 random_subset(x) == x;
 EXTERNAL_FUNCTION_random_subset(RANDOM_TYPE) == POW(RANDOM_TYPE) --> POW(RANDOM_TYPE);

 // generate a random permutation sequence from a set
 random_ordering(x) == [];
 EXTERNAL_FUNCTION_random_ordering(RANDOM_TYPE) == POW(RANDOM_TYPE) --> seq(RANDOM_TYPE);
 
 // generate a random permutation sequence from a sequence
 random_permutation(x) == [];
 EXTERNAL_FUNCTION_random_permutation(RANDOM_TYPE) == seq(RANDOM_TYPE) --> seq(RANDOM_TYPE);
 
 // generate a random set of numbers drawn from low..up, each with probability p/q
 random_numset(prob_numerator,prob_denominator,low,up) == low..up;
 EXTERNAL_FUNCTION_random_numset == (INTEGER*INTEGER*INTEGER*INTEGER) --> POW(INTEGER);

 // generate random numbers using normal (Gaussian) distribution with given mean and sigma
 EXTERNAL_FUNCTION_NORMAL == INTEGER*INTEGER --> INTEGER;
 NORMAL(mu_mean,sigma) == mu_mean;

 // versions working with REAL numbers:
 EXTERNAL_FUNCTION_RNORMAL == REAL*REAL --> REAL;
 RNORMAL(r_mu,r_sigma) == 0.0;
 
 // number of arrivals within time unit (ok up until value of lambda of 746.0):
 EXTERNAL_FUNCTION_RPOISSON_COUNT == REAL --> INTEGER;
 RPOISSON_COUNT(lambda) == 1;
 // to sample waiting time until next arrival use:
 EXTERNAL_FUNCTION_RPOISSON_WAIT == REAL --> REAL;
 RPOISSON_WAIT(lambda) == 1.0; // could be defined by -RLOGe(RAND(0.0,1.0))/lambda;
 
 // generate uniformly distributed random numbers between lower and upper value (not included)
 EXTERNAL_FUNCTION_RAND == REAL*REAL --> REAL;
 RAND(rnd_low,rnd_up) == rnd_low;
 
 EXTERNAL_FUNCTION_RAND_SAMPLES == INTEGER*REAL*REAL --> POW(REAL);
 RAND_SAMPLES(nr_of_samples,rnd_low,rnd_up) == {};
 
 EXTERNAL_FUNCTION_RAND_BOOL == REAL --> BOOL;
 RAND_BOOL(rnd_limit) == TRUE;
 // example usage r=RAND_BOOL(0.2) -> 20 % chance of returning TRUE
