add efficient mean and median for ranges
median == mean for ranges
Merge pull request #8089 from stevengj/rangemean

add efficient mean and median for ranges