-
-
Notifications
You must be signed in to change notification settings - Fork 345
Description
Currently the FastRandom
class has Next(int, int)
and Next(float, float)
.
The int
version returns a random integer value that is between the inclusive lower bound and the inclusive upper bound. The upper bound is inclusive due to the additional + 0.5f
to the value.
However the float
version returns a random float value that is between the inclusive lower bound and exclusive upper bound.
This makes using the methods counterintuitive and they also do not mirror the same behavior already set by the System.Random
class. I can't see a purpose in the int method allowing the maximum value to be inclusive, however changing this will be a breaking change given then nature of how FastRandom
works.
It should also be noted that the FastRandom
class is based on FastRand
class from Mecury Particle Engine, which appropriately uses exclusion on the upper bound for both the int and float methods.
I'm not sure why the + 0.5f
as added to the int methods to make the upper bound inclusive, it looks like it was this way from the beginning when Dylan originally brought the code over.