How do I generate random numbers in buttons without them overlapping?

I am creating a number memory game and the game requires to generate random numbers from 1 to 9 in 9 respective buttons without the numbers overlapping. Here is my code, please help me to see if there is anything wrong, thanks!

That doesn't work, if any iteration matches with an already selected number, that iteration doesn't do anything...:


Take a look at this (deleting elements from a list, to avoid repeating ):

App Inventor Code Snippets | Pura Vida Apps

Thanks for the help but the even after I tried to add the code recommended it still didn't work. Is there any other way to solve the problem?


What if the random numbers has to be generated once the game is initialized so that the players can try to remember them?

and is there any way to generate random numbers instead of following a sequence?


Maybe with this in the initialize block:


It generates 9 numbers, randomly between 1 and 100 and set the to 9 buttons text. With no overlapping.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

You want a random permutation of a list?

Search this board for a shuffle procedure.

Thanks for your help!