Random Numbers

For questions about using Classic.

Post » Fri Jul 23, 2010 1:51 am

I know how to generate a random number but it's not doing what I want.
I want it to generate a whole number between 1 and 4.
But when I write in (random(4)) the number 0 comes up too, and I don't want that.
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Fri Jul 23, 2010 2:01 am

do random(4)+1

random(4) is a number between 0 and 3

it doesn't make sense exactly, but now you know

and any other case to generate a number between something just add a number to it
a number between 10 and 20 would be random(11)+10
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Fri Jul 23, 2010 3:16 am

Thanks, it works nicely.
B
2
G
4
Posts: 50
Reputation: 1,150

Post » Fri Jul 23, 2010 7:29 pm

You could also just script it with python.

import random
random.seed()
print random.randint(1,10)
B
3
G
2
Posts: 31
Reputation: 737


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests