random_func

Generates a random value between 0 and high_value, not including high_value. If called by the same player on the same frame with the same index, this function will always return the same value (making it replay-safe).

ArgumentTypeDescription
index:realIndex of the function call, must be between 0 and 24
high_value:realThe high end of the range from which the random number will be selected
floored:realIf the number returned should only be a whole number

Example, called from update.gml:

// sets both hsp and vsp to separate random numbers between -50 and 50:
hsp = -50 + random_func( 0, 100, false );
vsp = -50 + random_func( 1, 100, false );

Note that the first argument of each separate function call is different, otherwise they would return the same number!