Counting the number of values in each interval
BinCounts[aRRay, {0, 0.4, 0.1}]
HistogramList[aRRay, {0, .4, .1}][[2]]
{1, 2, 0, 4}
This is slower than BinCounts
for regularly spaced bins:
SeedRandom[43]; aRRay = Sort@RandomReal[1, 1000000];
BinCounts[aRRay, {0, 1., .1}] // Timing
{1.093812, {99869, 99884, 100051, 100351, 99540, 99971, 99695, 99930, 100337, 100372}}
HistogramList[aRRay, {0, 1., .1}][[2]] // Timing
{1.527600, {99869, 99884, 100051, 100351, 99540, 99971, 99695, 99930, 100337, 100372}}
Slightly faster for irregular bins:
bins = Flatten[{0, Sort[RandomReal[1, 50]], 1}];
BinCounts[aRRay, {bins}] // AbsoluteTiming // First
1.667586
HistogramList[aRRay, {bins}][[2]] // AbsoluteTiming // First
1.606415