How do I make random 16 digit number?

Just started using Construct 2? Post your questions here

Post » Sun Jul 27, 2014 2:12 pm

anyone could help me please?
~Everyone can make GAMEs~
B
54
S
10
G
1
Posts: 411
Reputation: 5,655

Post » Sun Jul 27, 2014 2:54 pm

The quicker way I can think right now is something like that:

number = ""

for i = 1 to 16
number = number & str(int(random(10))
next

This gives you a 16 digits string from 0 to 9.
I'm not a insane, my mother had me tested

I'm an engineer. To save time, just assume I'm never wrong
B
30
S
12
G
4
Posts: 141
Reputation: 4,782

Post » Sun Jul 27, 2014 5:21 pm

what that mean "for i " ??
~Everyone can make GAMEs~
B
54
S
10
G
1
Posts: 411
Reputation: 5,655

Post » Sun Jul 27, 2014 5:36 pm

Hardty wrote:what that mean "for i " ??


It is the classic way of representing a loop,
It is the for loop in C2 that you will use in your case, you can also just use a repeat 16 times loop.

Also you will have, before running the loop, to set number to "".
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sun Jul 27, 2014 5:40 pm

Jeff Skyrunner wrote:The quicker way I can think right now is something like that:

number = ""

for i = 1 to 16
number = number & str(int(random(10))
next

This gives you a 16 digits string from 0 to 9.

Thankss That's Work! :D

Aphrodite wrote:
Hardty wrote:what that mean "for i " ??


It is the classic way of representing a loop,
It is the for loop in C2 that you will use in your case, you can also just use a repeat 16 times loop.

Also you will have, before running the loop, to set number to "".

Thanks for answering :mrgreen:
~Everyone can make GAMEs~
B
54
S
10
G
1
Posts: 411
Reputation: 5,655


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests