As long as you also increase the the multiplier to your array limit + 1, it should always work.
What I would do is this:
var i = Math.Floor(Math.Random * r_text.length)
That way no matter how many things you choose to put into the array, the multiplier will always be correct (the .length of an array is always one larger than the largest value of the array so no + 1 is needed). I thought about that the first time, and then forgot to put it in the post.