Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Generating random numbers

$
0
0
Well, I got a question again that I was asked to generate random numbers from range 1 to 100, afterwards displays the list, that is higher the average of the list.

For example, if I generated 10 numbers in the list
[6, 21, 48, 17, 17, 76, 81, 92, 54, 100]

Average: 51.2

Output:
[76, 81, 92, 54, 100]

Alright, this is the simple part that I was able to solve. I wonder what if the average was 17, how would I avoid multiple numbers that are being repeated?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>