Skip to content

Commit d1ea278

Browse files
committed
use randperm! again, as it supports Memory now
The PR #58596 was merged.
1 parent 6ebd824 commit d1ea278

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/Random/src/misc.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ function shuffle(rng::AbstractRNG, tup::NTuple{N}) where {N}
203203
else
204204
UInt
205205
end
206-
# TODO: use `randperm!` instead of `copyto!` from a unit range once `randperm!` supports `Memory`
207-
mem = @inbounds shuffle!(rng, copyto!(Memory{Ind}(undef, N), Base.OneTo(N)))
206+
mem = @inbounds randperm!(rng, Memory{Ind}(undef, N))
208207
function closure(i::Int)
209208
@inbounds tup[mem[i]]
210209
end

0 commit comments

Comments
 (0)