Deadcows / MyBox

MyBox is a set of attributes, tools and extensions for Unity
http://deadcow.ru
MIT License
1.94k stars 244 forks source link

Misleading RandomInRange(this MinMaxFloat minMax) summary comments #162

Closed hamtaren closed 3 years ago

hamtaren commented 3 years ago

Hi, I got mislead a little, by RandomInRange(this MinMaxFloat minMax) and RandomInRangeInclusive(this MinMaxFloat minMax) effects and comments in summary.

Since Random.Range (while using float) is [minInclusive..maxInclusive] and int [minInclusive..maxExclusive] when I got my minMax set: min: 0.75f, max: 1.0f I got output range from: 0.75f to 2.0f while using RandomInRangeInclusive(this MinMaxFloat minMax). I know the intentions behind it, especialy for the ints, but for floats comment in RandomInRange's summary is misleading: image

I don't know how it could be done better, I thought I'd just report this, because it might be tricky to change RandomInRange into RandomInRangeExclusive and RandomInRangeInclusive into RandomInRange.

Deadcows commented 3 years ago

Thanks for the report! I made this extensions for MinMaxInt and blindly copypasted them for MinMaxFloat. RandomInRangeInclusive for MinMaxFloat is removed (since it's inclusive already) and summary changed for MinMaxFloat.RandomInRange accordingly