GM: random

From GMpedia.org Wiki

Jump to: navigation, search

random
 

Type: function
Arguments: 1: maximal value
Limitations: none
The correct title of this article is random(). It appears incorrectly here because of technical restrictions.

The random() function in Game Maker returns a random value that is greater than or equal to 0 and less than the value you define yourself as the first argument.

Note that this function does not round values to integers. Also, random() does not return negative values.

[edit] Examples

According to the definition above:

t=random(5);

Will never return 5, in order to return '5', the GM: ceil function must be used.

Personal tools