Name

random — generates a random number

Synopsis

int random(limit);
int limit ;

Description

Generates and returns a random number ranging from 0 up to but not including the value of limit. If the optional parameter limit is omitted then the upper limit is up to but not including 0x10000 (i.e. it is a 16 bit random number).

Example 44. random Example

// Produce a random colour in HTML notation
string colour = "#"
  + hex(random(256), 2)
  + hex(random(256), 2)
  + hex(random(256), 2);