Skip to content

random_range

CryoEagle edited this page Jan 14, 2019 · 6 revisions

random_range

Returns a random number from n1 to n2

Syntax:

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

Returns: double

Description:

This function will return a random number from your selected lower range number to your selected upper range.

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:

double randomNumber = random_range(2,4);

This code will set the value of the variable randomNumber anywhere in the range of 2 to 4.

Back to number_functions

Clone this wiki locally