Function PGARandomInterval

Function Documentation

int PGARandomInterval(PGAContext *ctx, int start, int end)

Return a uniform random number on the specified interval.

Example

Generate a value uniformly random from the interval \([0,99]\)

PGAContext *ctx;
int r;

...
r = PGARandomInterval (ctx, 0, 99);

Parameters
  • ctx – context variable

  • start – starting (integer) value of the interval

  • end – ending (integer) value of the interval

Returns

A uniformly distributed random number in the interval [start, end]