Help, Please! variable

How can I create a random number draw without repetition using structure variables?

Question:
Hi! I’m trying to create a number draw system in GDevelop where I randomly select numbers (for example, from 1 to 20), but I need to make sure that each number is only drawn once — no repetitions.

I understand that I need to use a structure variable to track which numbers have already been drawn, but I don’t know how to check or update that structure properly within the GDevelop event system.

I’ve already tried using AI to help me build this logic, but I’m still stuck. I don’t know exactly how to structure the condition that checks whether a number has already been used, or how to store that number inside the variable to avoid drawing it again.

In short:
I want to draw 10 unique random numbers, without repeating any.
Can anyone show me how to do this using the built-in event system (no JavaScript)? Maybe with a sample of how to set and check structure variables?

Thanks a lot in advance!

Use an array and the Array Tools extension. There’s an example in this thread, though replace the 52 with 10, and replace the VariableChildCount(...) with VariableChildCount(...)+ 1.

1 Like

MyArray needs to be empty if you want to auto populate your array

1 Like