The max value in the random range is now inclusive

There is a mistake in the quiz because the if you check on the unity website it says that max is inclusive.

1 Like

Hi @Alex_Petrov,

It depends on which type is used with the method. You can use either int or float as the data type with Random.Range().

If you use floats as the type then both the minimum and maximum values are inclusive.

If however you use ints as the type then only the minimum is inclusive, the maximum is exclusive.

In the secton, int is the data type that is used, as the guesses are all whole numbers.


See also;

Privacy & Terms