Skip to content

Commit

Permalink
warn about linear complexity for AbstractString (stevengj)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jun 6, 2017
1 parent f9b307a commit 86713e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ Pick a random element or array of random elements from the set of values specifi
`S` defaults to [`Float64`](@ref).
Note that the complexity of `rand(rng, s::AbstractString)` is linear
in the length of `s` if `s` is not of type `String`. If called more
than a few times, you should use `rand(rng, collect(s))` instead.
# Examples
```julia-repl
julia> rand(Int, 2)
2-element Array{Int64,1}:
Expand Down

0 comments on commit 86713e6

Please sign in to comment.