Game Maker

random(x) returns a random value between 0 and x.

Code Sample[]

y=random(room_height); // sets the y to a random position within the room

Other ways to generate random numbers[]

  • irandom(n) - only returns integers
  • irandom_range(n1,n2) - return integer between n1 and n2
  • choose(option1,option2,...) - picks one of the options
  • random_set_seed(seed_value), random_get_seed() - influence the outcome of random(x)

See Also[]