Random number between 2 values

Get help using Construct 2

Post » Thu Sep 10, 2015 8:47 am

floor(random(0,2))

Set a random number into 0 and 1.
B
5
S
1
Posts: 47
Reputation: 469

Post » Thu Sep 10, 2015 9:34 am

"floor(random(b-a+1)) + a"

This gives the most equal chances to return an integer number from "a" to "b" (including them).
Image
B
24
S
12
G
52
Posts: 850
Reputation: 29,825

Post » Sun Dec 13, 2015 4:13 am

What if I want to set x to floor(random(1,8)) EXCLUDING the current x (1 <= x <= 8)?
B
6
S
1
Posts: 14
Reputation: 328

Previous

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, zenox98 and 3 guests