Index was outside the bounds of the array [closed]

int[] damageNumbers = new int[4] { 5, 10, 15, 20 }; int rand = UnityEngine.Random.Range(0, 5); enemyDamage = damageNumbers[rand]; 

The Unity documentation and the code explanation in the code editor states that the max value is exclusive, so if I want the random value to be from 0 to 4, I put int (0, 5).

For some reason Unity is getting an IndexOutOfRangeException and it says it is the 3rd line in my code, why is that? Thanks in advance. 🙂