1

What should be the approach to generate 10 unique numbers that should not match among a group of 10 people's generated answer ?

4
  • No alphabets or special characters are allowed, only with 0-9 and sum of 10 random number should be minimum. Commented Apr 13, 2012 at 15:00
  • 3
    A GUID is just a number. You don't have to display it in hexadecimal with separating dashes. Commented Apr 13, 2012 at 15:03
  • @cha0site: You should list your guid comment as an answer. Commented Apr 13, 2012 at 16:07
  • Surely the condition "sum of 10 random number should be minimum" makes the choice not random Commented Apr 19, 2015 at 13:16

2 Answers 2

3

This one has a nice solution. I'm assuming you have to give numbers 1-10 to 10 different people in a random way (but the principle also works if you have 10 (or more) different, non-consecutive numbers).

Sign up to request clarification or add additional context in comments.

Comments

2

You could use OS facilities to generate a GUID (globally unique identifier).

A GUID is a 32-digit hexadecimal that looks like this: {21EC2020-3AEA-1069-A2DD-08002B30309D} (shamelessly stolen from the GUID wikipedia article). That makes it a 128 bit number. Now, it has all those annoying characters in the way, but there's nothing stopping you from removing the extraneous character and converting from hex and treating it as a plain number.

For practical reasons, you'll want to note that a 128-bit number is a bit unwieldy in some languages, such as C99. But you can still use compiler extensions (GCC has __uint128_t) or deal with it some other way.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.