I am getting "Index was outside the bounds of the array." error when using this code:
Dim RandomA As String = "aAÀàÁâÄäÅåĀāĂ㥹ǞǟǺǻÃãÄ"
Tex开发者_运维百科tBox1.Text = TextBox1.Text.Replace("a", RandomA((Int(Rnd() * RandomA.Count)) - 1))
I fail to see how the (random) index can be out of bounds?
Int(Rnd() * RandomA.Count)
could return 0, and 0 - 1 is outside the bounds.
it is an edge condition for sure. the equation evaluates to -1 under certain random number conditions.
精彩评论