JuliaLang/julia — pull request #3375 by kmsquire (2013-06-13 04:03:19+00:00)
Title: Added select!(v, r::Range1)

This is something I actually thought about before, but now is in direct response to 6f23b428d7.

Seems to work:

```julia
julia> for i = 1:10000
lim=10000; a = rand(lim); b = copy(a); i1 = rand(1:lim-1); i2 = rand(i1:lim)
sort!(b)
@assert select!(a, i1:i2) == b[i1:i2]
end

julia>
```

Also improves `median` calculation slightly.

Before:

```julia
julia> x = randn(10000);

julia> sum([@elapsed median(x) for i in 1:1000])
1.0680626930000012

julia> sum([@elapsed median!(x) for i in 1:1000])
0.6929740309999998
```

After:
```julia
julia> median(x);

julia> sum([@elapsed median(x) for i in 1:1000])
0.9136840810000004

julia> sum([@elapsed median!(x) for i in 1:1000])
0.6345926139999998
```