I need to know how you break an array into sub-arrays based on the value of the integers in the array. What I'm trying to do is take a large array and break it into 1-10, 11-20, 21-30...etc and I need to then be able to count those sub arrays so I have numbers that are like "7 integers between 1-10, 6 integers between 11-20, 12 integers between 21-30."
I've got a single line random number generator that will give me my array like the following:
rand_num = (Array.new(200) {(1..100).to_a[rand(100)]})
This gives me my array of 200 hundred random numbers between 1 and 100 and now I need to be able to split them apart according to value and tell how much is in each one.
Then I need it to display those numbers. I've searched everywhere and I want to say you do this with .partition, but I just can't get it to work.