I'm trying to create a histogram from an array of numbers in the range `[0,1]`.

Is there a way to use `group_by` to separate the array into N groups/bins by numeric interval (or some other fun Ruby one-liner)?

This is my current, boring, solution:

```
# values == array containing floating point numbers in the range [0,1]

n = 10

# EDITED from Array.new(n, 0) to Array.new(n, []), thanks emaillenin!
histogram = Array.new(n, [])
values.each do |val|
  histogram[(val * n).ceil - 1].push(val)
end

```