UnityEngine.Random.Range and System.Random.Next both return a random int between min and maxExclusive. However, for the special case that min == max, min is returned. This is slightly inconsistent because it conflicts with the definition of exclusive. However, it's actually very convenient, because it makes the bag work with a single item. This use case could happen during development where the bag is supplied with a stand-in collection that only contains a single item, for example.
There's no real problem here, but maybe we can make it more clear, what the IRandomRangeSource interface is expected to return or implement some tests to solidify this. Potentially, it also makes sense to catch this condition in the ShuffleBag.Next function directly, because we don't have control over custom user implementation of IRandomRangeSource.
UnityEngine.Random.Range and System.Random.Next both return a random int between min and maxExclusive. However, for the special case that min == max, min is returned. This is slightly inconsistent because it conflicts with the definition of exclusive. However, it's actually very convenient, because it makes the bag work with a single item. This use case could happen during development where the bag is supplied with a stand-in collection that only contains a single item, for example.
There's no real problem here, but maybe we can make it more clear, what the IRandomRangeSource interface is expected to return or implement some tests to solidify this. Potentially, it also makes sense to catch this condition in the ShuffleBag.Next function directly, because we don't have control over custom user implementation of IRandomRangeSource.