How to: Only repeat cards after a set amount of clicks?

Hey all, I’ve currently got a small test in my game where clicking will randomly spawn an object within a group (currently at mouse location as it’s easier to see)

What I want to implement is no repeating cards until I’ve reached a set amount of clicks (obviously depending on how many cards I have in the set) upon reaching this amount of clicks, cards that have already been played can now be played again, and so the process would repeat.

I’m quite new to gdevelop so any help would be really appreciated thank you! :slight_smile:

You will probably need JavaScript to do what you want. For the most basic solution you basically just want to create an array of the possible values, randomize that array, then iterate through that array each time you need a random number, then when you reach the end of the array, randomize it again and iterate from the begining.
Here’s quick snippet on how to randomize an Array using JavaScript:

Unfortunately GDevelop doesn’t have any native way to sort arrays or do advanced manipulation of them.