Suppose I had a int array
array=( 1 2 3 4 5 6 7 8 9 10 )
How would I pick a random number from the top 30% of the array, numbers 8, 9, or 10.
I know to pick a number at complete random in the array is:
${array[RANDOM % ${#array[@]}]}
However I don't know how to do pick a random element in a percentage of the array,