random number

Get help using Construct 2

Post » Sat Jun 08, 2013 10:38 pm

PLease how to generate random number? I tryed random(2) as in Classic but it does not work in construct 2... Why? SOme declaration randomize like in pascal or????
B
25
S
4
G
2
Posts: 318
Reputation: 2,481

Post » Sat Jun 08, 2013 10:41 pm

This might help:

https://www.scirra.com/tutorials/315/generating-random-numbers-without-duplicates
B
6
S
1
Posts: 62
Reputation: 532

Post » Sat Jun 08, 2013 11:37 pm

You did it right, not sure why it doesn't work for you.

From the manual:

random(x)
Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.

random(a, b)
Generate a random float between a and b, including a but not including b.
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,522


Return to How do I....?

Who is online

Users browsing this forum: 13spongg13, Kenthria and 5 guests