arr = [1,9,5,2,4,9,5,8,7,9,0,8,2,7,5,8,0,2,9]
arr[rand(arr.count)]
This will return a random element from array.
If You will use the line mentioned below
arr[1+rand(arr.count)]
then in some cases it will return 0 or nil value.
The line mentioned below
rand(number)
always return the value from 0 to number-1.
If we use
1+rand(number)
then it may return number and arr[number] contains no element.