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
6
S
1
Posts: 50
Reputation: 502

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
30
S
16
G
55
Posts: 864
Reputation: 31,907

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: inbong, Yahoo [Bot] and 12 guests