Skip to content

irandom_range

CryoEagle edited this page Jan 14, 2019 · 4 revisions

irandom_range

Returns random whole number from n1 to n2

Syntax:

irandom_range(n1, n2)
Argument Description
int n1 The lower range from which the random number will be selected
int n2 The upper range from which the random number will be selected

Returns: int

Description:

This function will return a random number from your selected lower range number to your selected upper range, it is similar to random_range, but this will return a whole number rather than a decimal.

NOTE: This function will return the same value every time the game is run due to the fact that SimplexRpgEngine generates the same initial random seed every time to make debugging code a far easier task. To avoid this behavior, use randomize() at the start of your game.

Example:

int myNumber = irandom_range(64,512);

This code will set the variable myNumber to a random selected whole number from 64 to 512.

Back to number_functions

Clone this wiki locally