15,998,673 members
1.00/5 (1 vote)
See more:
Hello to all,

I have an exercise for my school and I have no idea how to solve it, can you please help me? :doh:

Exercise:

Write a program that randomly generates 100 integer values in the range 1 to 50. Your program should display how many numbers of the numbers generated occurred in the range 1..10, 11.. 20, etc.
For example, your program might display:

```1..10  20
11..20 25
21..30 12
31..40 23
41..50 20```

Thank you very much!
Posted
Updated 2-Jan-11 10:40am
v2

## Solution 1

1) use the RANDOM class
2) create an array to store the 5 categories
3) check the returned random number against the category limits and increment the value stored in the relevant array index
4) display the output
5) repeat as required

Manfred Rudolf Bihy 2-Jan-11 16:45pm
My answer would have run along these lines, so I refrain. Have my 5!
Kasson 3-Jan-11 0:50am
Good Clue. My 5 too.
Shani Natav 3-Jan-11 3:54am
I'm tempted to give him an overly complicated solution....