Skip to content

Commit

Permalink
update doc (tkelman & ararslan)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jun 11, 2017
1 parent 2ab612e commit 5c195d8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions base/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,7 @@ Pick a random element or array of random elements from the set of values specifi
`S` defaults to [`Float64`](@ref).
!!! note
The complexity of `rand(rng, s::Union{Associative,AbstractSet})`
is linear in the length of `s`, unless an optimized method (with
constant complexity) is available (which is the case for `Dict`,
`Set` and `IntSet`). For more than a few calls, use `rand(rng,
collect(s))` instead (or `rand(rng, Dict(s))`, or `rand(rng,
Set(s))`).
# Examples
```julia-repl
julia> rand(Int, 2)
Expand All @@ -280,6 +274,14 @@ julia> rand(Int, 2)
julia> rand(MersenneTwister(0), Dict(1=>2, 3=>4))
1=>2
!!! note
The complexity of `rand(rng, s::Union{Associative,AbstractSet})`
is linear in the length of `s`, unless an optimized method with
constant complexity is available, which is the case for `Dict`,
`Set` and `IntSet`. For more than a few calls, use `rand(rng,
collect(s))` instead, or either `rand(rng, Dict(s))` or `rand(rng,
Set(s))` as appropriate.
```
"""
@inline rand() = rand(GLOBAL_RNG, CloseOpen)
Expand Down

0 comments on commit 5c195d8

Please sign in to comment.