I'm using unity's random.value function (I think i saw this behavior also somewhere else), which as the documentation states works as follows.
Both 0.0 and 1.0 may be returned by this property. This behaviour is different to that of many other random number generators which return a value less than but never exactly equal to 1.0.
Now when using this method somewhat like this
int[] array = {1, 2, 3, 4, 5};
int number = array[(int)(Random.value * array.length)];
do i have to worry about getting an ArrayOutOfRangeException, when all planets are lined up? And does that mean that i'm forced to do it like this for the sake of me beeing abled to sleep at night?
int number = array[(int)((Random.value - Float.epsilon) * array.length)];
Further i would like to know why someone would create a random function that isnt returning numbers only smaller than one? Is there any hidden benefit in doing it that way?