- Since the formula for arithmetic mean = (a1 + a2 + ...an ) / n, 50 numbers that have a sum of 4650 will not produce an arithmetic mean of 68. The arithmetic mean in that case would be 93. 50 numbers that have an arithmetic mean of 68 will have a sum of 3400.
- There are not 50 numbers between 50 and 100 inclusive ( 51 ) or non inclusively ( 49 )

I am going to assume that for ( 1 ) you want the sum to be 4650, and want randomly selected numbers that add up to that. I am going to assume that ( 2 ) you are looking for numbers between 50 and 99, inclusively.

In javascript to test the idea without actually checking for a specific number :

var arr = {}; var totals = 0; var count = 0; while (totals < 3900) {totals = 0; count++; for ( var j = 50 ; j < 100; j++ ) { arr[j-50] = Math.round(50*(Math.random()+1)); totals += arr[j-50];} }

In C# I wrote the following, but the execution time is too long to get a practical result :

** Random randomNumberGenerator = new Random();**

** int count = 0;**

** int totals = 0;**

** int[] arr = new int[50];**

** while (totals != 4650) { totals = 0; count++; for (var j = 50; j < 100; j++) { arr[j-50] = (randomNumberGenerator.Next(50, 100)); totals += arr[j-50]; } }**

Consider the following for all totals > 4000, which would include 4650 as well

Random randomNumberGenerator = new Random();

int count = 0;

int totals = 0;

int[] arr = new int[50];

while (totals **<** 4000 ) { totals = 0; count++; for (var j = 50; j < 100; j++) { arr[j-50] = (randomNumberGenerator.Next(50, 100)); totals += arr[j-50]; } }

It found the value for 4015, which are below :

{ 96, 87, 89, 65, 98, 88, 85, 80, 94, 81, 69, 67, 91, 70, 61, 97, 79, 67, 72, 57

, 65, 86, 57, 90, 87, 94, 52, 71, 74, 99, 87, 96, 75, 66, 60, 98, 99, 97, 68, 90

, 89, 99, 85, 69, 87, 77, 85, 59, 89, 72 }

However, it took the code 49 attempts to reach this point, the next time I run it, it could take more or less.

Do you actually want a ** random **assortment of numbers between x and y or do you need to know any combination of numbers adding up to 4650? I think there are a lot of questions, and the only answer I can think of is code that I ran for nearly an hour and could not reach an answer.