Maybe you’re looking for this:
julia> sample.(Ref(myspace), 3:5; replace=false, ordered=true)
3-element Vector{Vector{Int64}}:
[4, 5, 7]
[3, 4, 6, 10]
[2, 3, 6, 9, 10]
Here I use Ref
to “escape” myspace
from broadcasting. If I write sample(myspace, 3:5)
it will broadcast on both myspace
and 3:5
. Wrapping with Ref
is like creating a container with one element, so it broadcasts on Ref(myspace)
which has just a single value myspace
in it.
Equivalently you could do
sample.((myspace,), 3:5; replace=false, ordered=true)
or
sample.([myspace], 3:5; replace=false, ordered=true)