This is a little script that gives you more control over random number generation. Note: This script is meant for GameMaker versions 7 and below, in GameMaker 8 the functions irandom, irandom_range and random_range were added. If you have an earlier version, this script will have the same functionality as these functions.

if (argument2)
  return floor(random(argument1 - argument0 + 1)) + argument0;
  return random(argument1 - argument0 + 1) + argument0;

It should be obvious what each argument means.

Leave a Reply

Name and website fields are completely optional.