Random number not including some numbers

Get help using Construct 2

Post » Thu Jun 27, 2013 2:54 pm

I want to generate a random number between 0 and 59 but I dont want some numbers like the 3 and 5. There's a way to make exceptions in the generation of the number?

I mean something like: round(random(0,59)) exceptt -> 3,5

Thanks.

PD: I tried to post this 2 times but the forum didnt let me, so if it appears 3 times is for that.
B
6
S
2
Posts: 61
Reputation: 1,099

Post » Thu Jun 27, 2013 3:17 pm

You need an Array and delete the numbers you dont need, this could help you: HERE
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Jun 27, 2013 3:47 pm

Another way if its not a lot of numbers just store it in a local variable.

Then add:

Roll = 3
Roll = 5
While()

And in the Action add Roll = round(random(59))

Then if its roll 3 or 5, it will roll again. and continue if it doesn't.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Thu Jun 27, 2013 4:07 pm

nice nice i thought in a variable like you tell me, but i didnt know how to use it correctly! thank u both of u! :)
B
6
S
2
Posts: 61
Reputation: 1,099


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests