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
Posts: 46
Reputation: 317

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
11
G
41
Posts: 791
Reputation: 24,100

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: Baidu [Spider], BinaryPanda, MarkThomas and 19 guests