Random numbers and MaxStepsToEncounter

It may be worth mentioning that when using an INT with Random.Range, the “minimum” is INCLUSIVE but the “maximum” is EXCLUSIVE. So if you want to use the max number, you have to add +1 to the maxStepsToEncounter.

If you use a float, both the min and max are INCLUSIVE.

This will give you a random number from 5 - 9:

int randomNumber = Random.Range(5, 10);

This will give you a random number from 5 - 10:

float randomNumber = Random.Range(5f, 10f);

Something to be aware of

1 Like

Privacy & Terms