How many random numbers make up a 100

Hallo People,

Please help me solve this problem:
Assuming you have an array of these values x=[16,18,23,24,39,40] how would you write a function to generate random numbers that can add up to a 100? I need to know how many random numbers can add up to a 100.

Thanks.
Leo
Assuming you have an array of these values x=[16,18,23,24,39,40] how would you write a function to generate random numbers that can add up to a 100?


How do random numbers enter into it? If random numbers do enter into it how does the set of values x enter into it? What you're asking makes no sense.
If the values have to be integers then you can get a solution to this otherwise, there are infinitely many numbers that would do that

Also do the numbers that add up to 100 have be unique? If so, the solution size gets even smaller, otherwise you are now looking are permutations and combinations.
Last edited on
Topic archived. No new replies allowed.