# How do I generate several random, but not repeating numbers?

0 favourites
• 8 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
• Hello everyone! I have 5 text objects. I need to generate randomly 5 numbers in the range from 1 to (eg)10. But none of these numbers should be repeated. I found a way through an array. I set the values in the array from 1 to 10. Then I randomly generate the first number, then I remove it from the array, and from the remaining numbers I generate the second number. etc. It Works with numbers. But with letters, this method works a little more complicated. Can you suggest a simpler way? Thank you!

• Create a permutation table size 26 with the advanced random plugin. Associate each letter with a number, 0-25.

• it doesn't really solve my problem. eg

"first number" is 6.

"second number" should be (10 - "first number"). = 4

"third number" is ("first number" + "second number") = 10 (right answer)

"fourth number" should be int(random(1,11)) but not 10

"fifth number" should be int(random(1,11)) but not 10 and "fourth number"

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• My example is a general type of text randomization

1)Is it some sort of quiz?

2) I will called your first 3 values a,b,c. What will happen if a=5 (5,5,10,x,y) Will both answers be correct?

3) What will happen if a=10 (10,0,10,x,y) Will both answers be correct?

4) Will the third answer always be 10?

• Your OP said you needed to generate a set of nonrepeating numbers. That's what the permutation table does. And you were talking about letters.

Your second post has nothing to do with either of these things, and is not specific enough to build any particular solution without answering the issues mrcgkh raised.

• I apologize for not correctly wording the problem. I have a very small English vocabulary. I think it's better to show the project. I would really appreciate it if you take a look. The question is, how can I simplify the process of picking two, or more wrong, random answers, which won't repeat the right one? I'm going to do a similar quize with words and a missing syllable.

• Here's an older example I made.