Post

Replies

Boosts

Views

Activity

Random number without repetition
I have an array with 4 strings. These correspond to 4 images. One should be selected at random from this array. I have a userScore that is set over 👍 and 👎 button, up and down. Each time a random number is generated via Int.random (in: 0 .. <4), which then also ensures that the corresponding view is reloaded and a new image is displayed. Now the array only consists of 4 elements and therefore it is often repeated. How can I best solve this, that it is excluded that the previous number is selected again? Does anyone have a tip for me?
1
0
572
Jan ’22