Right, it is hitting the new quote button and checking if there is a new quote, as in different than the previous quote. So, if your random quote is #1, then the random index happens to be 1 the next time, it will fail that test. Considering that you have three quotes, I would expect that to happen about 1/3 of the time.

So, I see two options:

The “easy” way - Add more quotes. The more quotes you have, the less likely it is to get two of the same in a row. This is kind of cheating, but OK.

The “better way” - See if you can find a way to ensure that you don’t get the same index twice in a row. I can think of two ways - an ugly way and an elegant way.

The common method with this would be something like a while loop, You loop until the new index is not equal to the old sequence. An if statement wouldn’t work since you may have to do it more than once. This is the method that probably first occurs to people, but I think it’s messy.

I think a more elegant approach would be to consider the possible values needed in a circle. If there are 10 possible indices, then the next indices should be 1-9 spaces away. I could generate that random number, then add it to my index and take the modulus of the total number of possible indices. Then I have a new index without having to loop indefinitely.