Utilities.cs
v4.0
Rounding is an enum
with options None
, Floor
, Ceiling
, and Round
.
RoundThis()
Send in a float
value
, and a number of decimal places, and optionally a different rounding method, and get a new value back!
RoundToDecimal()
RoundThis()
may actually call this method, depending on the options. This takes in a float
value
and int
decimals
, and returns the float
rounded to the number of decimals.
RandomFloat()
Returns a float
value between min
and max
. If none are provided, will return between 0f
and 1f
.
RandomFloatBestOf()
This will return a value between min
and max
as well. However, it will generate multiple numbers, and return the highest or lowest, depending on the value of higherIsBetter
. Defaults to higher values being better, 2 rolls, and 0f
to 1f
.
RandomInt()
Returns an int value between min and max. Defaults to 0
to 100
.
RandomInt()
can return the highest value. Random.Range
is inclusive when int
values are being used.
Last updated