Skip to content

Commit 552420f

Browse files
committed
rand(Tuple{...}) is now implemented in Random
1 parent e383450 commit 552420f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RandomExtensions"
22
uuid = "fb686558-2515-59ef-acaa-46db3789a887"
33
authors = ["Rafael Fourquet <fourquet.rafael@gmail.com>"]
4-
version = "0.4.3"
4+
version = "0.4.4"
55

66
[deps]
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

src/sampling.jl

+11
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ Sampler(::Type{RNG}, ::Type{T}, n::Repetition
228228
) where {RNG<:AbstractRNG,T<:Union{Tuple,NamedTuple}} =
229229
Sampler(RNG, make(T), n)
230230

231+
if VERSION >= v"1.11.0-DEV.573"
232+
# now `Random` implements `rand(Tuple{...})`, so be more specific for
233+
# special stuff still not implemented by `Random`
234+
# TODO: we should probably remove this
235+
Sampler(::Type{RNG}, ::Type{Tuple}, n::Repetition) where {RNG <: AbstractRNG} =
236+
Sampler(RNG, make(Tuple), n)
237+
238+
Sampler(::Type{RNG}, ::Type{NTuple{N}}, n::Repetition) where {RNG <: AbstractRNG, N} =
239+
Sampler(RNG, make(NTuple{N}), n)
240+
end
241+
231242
#### make
232243

233244
# implement make(Tuple, S1, S2...), e.g. for rand(make(Tuple, Int, 1:3)),

0 commit comments

Comments
 (0)