Skip to content

Commit e859850

Browse files
committed
remove rand!(::AbstractArray, ::AbstractArray) until JuliaLang#8246 is fixed
1 parent 75aa207 commit e859850

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

base/random.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,18 @@ rand(r::AbstractArray) = r[rand(randintgen(length(r)))]
202202

203203
# Arrays of random integers
204204

205-
function rand!(r::AbstractArray, A::AbstractArray)
205+
rand!(r::Range, A::AbstractArray) = rand!(r, A, ())
206+
207+
# TODO: this more general version is "disabled" until #8246 is resolved
208+
function rand!(r::AbstractArray, A::AbstractArray, ::())
206209
g = randintgen(length(r))
207210
for i = 1 : length(A)
208211
@inbounds A[i] = r[rand(g)]
209212
end
210213
return A
211214
end
212215

213-
rand{T}(r::AbstractArray{T}, dims::Dims) = rand!(r, Array(T, dims))
216+
rand{T}(r::AbstractArray{T}, dims::Dims) = rand!(r, Array(T, dims), ())
214217
rand(r::AbstractArray, dims::Int...) = rand(r, dims)
215218

216219

doc/stdlib/base.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -3952,9 +3952,9 @@ Random number generation in Julia uses the `Mersenne Twister library <http://www
39523952

39533953
Generate a random value drawn uniformly from the indexable collection ``coll`` (for example, ``1:n`` or ``['x','y','z']``). Optionally, generate a random array.
39543954

3955-
.. function:: rand!(coll, A)
3955+
.. function:: rand!(r, A)
39563956

3957-
Populate the array A with random values drawn uniformly from the indexable collection ``coll``.
3957+
Populate the array A with random values drawn uniformly from the range ``r``.
39583958

39593959
.. function:: randbool([dims...])
39603960

0 commit comments

Comments
 (0)