Drawing random numbers without duplicates [SOLVED]

For questions about using Classic.

Post » Mon Jan 20, 2014 12:01 am

Hi all :)
I have small problem with some events, loops and arrays.

h**p://i.imgur.com/BqJEAs6.jpg

I need to draw 5 unique numbers and store them in array (that's job for "losowanko" loop), and every time a number is drawn, "sprawd" loop should check if it's unique, by comparing it to previous array records.
Well, and here comes the problem: it doesn't work.
I mean, it draws numbers ok, but when record is duplicate it just draws next instead of replacing it with new number (and checking it of course). Once duplicate counter hits 2 or 3, "losowanko" loop seems to end or break.

Any ideas what's wrong with my events? I've spent last 4 hours trying to solve that, and nothing :(

'y' variable is 5 if it changes anything.


UPDATE - FIXED
After spending another 3 hours I've finally got it by making completely different set of events.

If there is anything I can make simpler or faster, please share your tips :)
Cap with explanations:
Cap me tenderDreamwalker2014-01-20 12:49:01
B
7
S
1
G
4
Posts: 6
Reputation: 1,256

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests