App needs memory

Hi

I have an app that is basically a button to push and a new random text will show.

The texts are picked at random and I would like a feature that prevents the same text to show again for the next 5-10 times.

The texts are kept in a lua table

table name{

[1] = " text",

[2] = “bla bla”

}

How would you go about implementing this?

My own thought is.

Make a list that remembers the number (up to 10 numbers)

Update the list so new gets in the list and oldest get removed.

In the random number picker I make an: If number is in list Then pick a new number

My own thought is.

Make a list that remembers the number (up to 10 numbers)

Update the list so new gets in the list and oldest get removed.

In the random number picker I make an: If number is in list Then pick a new number