GameMaker: Studio

GameMaker: Studio

View Stats:
zoruhartz Sep 20, 2015 @ 8:38am
[HELP] How can I tell Gamemaker with a Code to pick a random number of all numbers?
Hello,

How can I tell the game (with a code) to pick a random number.
< >
Showing 1-6 of 6 comments
Daynar Sep 20, 2015 @ 9:30am 
random(max number) will return a random number from 0-whatever number you enter. You will need to run randomize() some time prior in order to get a random seed though.
Thew Sep 20, 2015 @ 10:25am 
You can also use irandom(max_number) or irandom_range(min_number, max_number) if you want it to return a whole number.
zoruhartz Sep 20, 2015 @ 10:25am 
Okay, thanks!
Blind Sep 20, 2015 @ 5:14pm 
You can also use choose(a whole ton of numbers) for pseudo-random generation
random(a) : random value from 0 to a
random_range(a, b) : random value from a to b
irandom(a) : random integer value from 0 to a
irandom_range(a, b) : random integer value from a to b
choose(a, b, c, d, e, ...) : randomly choose from the list inside the bracket

this is what I know, this might be wrong(of course, I hope not)
[unassigned] Sep 21, 2015 @ 5:14am 
I suggest using irandom(numb) (a number from 0 to numb) or irandom_range(number1, number2) (an integer (whole number) between number1 and number2)
integers are friendly and with those two functions you can achieve plenty.
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Sep 20, 2015 @ 8:38am
Posts: 6