Selecting random number excluding one

Get help using Construct 2

Post » Mon Feb 27, 2012 5:08 pm

I want to do something like

exclude = 2;
variable = floor(random(4));
variable != exlude

If not repeat until variable != exlcude.

Is there an easy way to do this or do I have to code it myself?

I can't use choose because the random number may be very large

Thanks
B
30
S
9
G
6
Posts: 525
Reputation: 8,319

Post » Mon Feb 27, 2012 5:29 pm

How about
choose(floor(random(2)), floor(random(3,4)))
B
85
S
27
G
85
Posts: 5,074
Reputation: 57,882


Return to How do I....?

Who is online

Users browsing this forum: bazmat1963, bikachu, LaurenceBedford, lucstanislash, Yahoo [Bot] and 12 guests