Skip to content

Commit

Permalink
rand(Tuple{...}) is now implemented in Random
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Oct 9, 2023
1 parent e383450 commit 552420f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RandomExtensions"
uuid = "fb686558-2515-59ef-acaa-46db3789a887"
authors = ["Rafael Fourquet <fourquet.rafael@gmail.com>"]
version = "0.4.3"
version = "0.4.4"

[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
11 changes: 11 additions & 0 deletions src/sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ Sampler(::Type{RNG}, ::Type{T}, n::Repetition
) where {RNG<:AbstractRNG,T<:Union{Tuple,NamedTuple}} =
Sampler(RNG, make(T), n)

if VERSION >= v"1.11.0-DEV.573"
# now `Random` implements `rand(Tuple{...})`, so be more specific for
# special stuff still not implemented by `Random`
# TODO: we should probably remove this
Sampler(::Type{RNG}, ::Type{Tuple}, n::Repetition) where {RNG <: AbstractRNG} =
Sampler(RNG, make(Tuple), n)

Sampler(::Type{RNG}, ::Type{NTuple{N}}, n::Repetition) where {RNG <: AbstractRNG, N} =
Sampler(RNG, make(NTuple{N}), n)
end

#### make

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

0 comments on commit 552420f

Please sign in to comment.