# Random number generate without repeat.

Get help using Construct 2

### » Sat Dec 21, 2013 3:35 pm

My problem is very simple:

How do I create a random number between two value one time.
(Not repeat again n again... only once generate random number!)

So if I wrote that:

System - Set value: Set Glo_temp_vari to floor(random(3,13))

It will to generate a number between 3 and 13, but after it will to repeat again and again to infinitium. I want that it doesn't repeat again.

Something simple solution? Thx
B
5
S
1
Posts: 37
Reputation: 441

### » Sat Dec 21, 2013 4:41 pm

[QUOTE=Scap] My problem is very simple:

How do I create a random number between two value one time.
(Not repeat again n again... only once generate random number!)

So if I wrote that:

System - Set value: Set Glo_temp_vari to floor(random(3,13))

It will to generate a number between 3 and 13, but after it will to repeat again and again to infinitium. I want that it doesn't repeat again.

Something simple solution? Thx[/QUOTE]

Maybe a 'trigger once while true' (a system condition)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
23
G
18
Posts: 2,123
Reputation: 17,200

### » Sat Dec 21, 2013 4:59 pm

If you search on your own topic name you will find multiple answers.
B
71
S
22
G
279
Posts: 3,838
Reputation: 153,878

### » Sun Dec 22, 2013 12:59 pm

Thanks Aphrodite!

It's work.
B
5
S
1
Posts: 37
Reputation: 441

### » Sun Dec 22, 2013 2:11 pm

Sorry, misread the question. If you just need something done once per layout, you use:
System:On start of layout.

You put all of your startup code in there, rather than adding 'Trigger once' to all of your conditions.
B
71
S
22
G
279
Posts: 3,838
Reputation: 153,878

### » Sun Dec 22, 2013 10:06 pm

No problem! Thx, it's also good idea.
B
5
S
1
Posts: 37
Reputation: 441