File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -203,15 +203,12 @@ function shuffle(rng::AbstractRNG, tup::NTuple{N}) where {N}
203203 else
204204 UInt
205205 end
206- clo = @inbounds let mem = Memory {Ind} (undef, N)
207- shuffle! (rng, copyto! (mem, Base. OneTo (N))) # just use `randperm!` once it supports `Memory`
208- let mem = mem, tup = tup
209- function closure (i:: Int )
210- @inbounds tup[mem[i]]
211- end
212- 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)))
208+ function closure (i:: Int )
209+ @inbounds tup[mem[i]]
213210 end
214- ntuple (clo , Val {N} ()):: typeof (tup)
211+ ntuple (closure , Val {N} ()):: typeof (tup)
215212 end
216213end
217214
You can’t perform that action at this time.
0 commit comments