|
76 | 76 |
|
77 | 77 | macro make_array_container(Cont) |
78 | 78 | definitions = |
79 | | - [ :(rand(rng::AbstractRNG, $Cont, dims::Dims) = rand(rng, make(t, dims))), |
80 | | - :(rand( $Cont, dims::Dims) = rand(GLOBAL_RNG, make(t, dims))), |
81 | | - :(rand(rng::AbstractRNG, $Cont, dims::Integer...) = rand(rng, make(t, Dims(dims)))), |
82 | | - :(rand( $Cont, dims::Integer...) = rand(GLOBAL_RNG, make(t, Dims(dims)))), |
83 | | - |
84 | | - :(rand(rng::AbstractRNG, X, $Cont, dims::Dims) = rand(rng, make(t, X, dims))), |
85 | | - :(rand( X, $Cont, dims::Dims) = rand(GLOBAL_RNG, make(t, X, dims))), |
86 | | - :(rand(rng::AbstractRNG, X, $Cont, dims::Integer...) = rand(rng, make(t, X, Dims(dims)))), |
87 | | - :(rand( X, $Cont, dims::Integer...) = rand(GLOBAL_RNG, make(t, X, Dims(dims)))), |
88 | | - |
89 | | - :(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Dims) where {X} = rand(rng, make(t, X, dims))), |
90 | | - :(rand( ::Type{X}, $Cont, dims::Dims) where {X} = rand(GLOBAL_RNG, make(t, X, dims))), |
91 | | - :(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Integer...) where {X} = rand(rng, make(t, X, Dims(dims)))), |
92 | | - :(rand( ::Type{X}, $Cont, dims::Integer...) where {X} = rand(GLOBAL_RNG, make(t, X, Dims(dims)))), |
| 79 | + [ :(rand(rng::AbstractRNG, $Cont, dims::Dims) = rand(rng, _make_cont(t, dims))), |
| 80 | + :(rand( $Cont, dims::Dims) = rand(GLOBAL_RNG, _make_cont(t, dims))), |
| 81 | + :(rand(rng::AbstractRNG, $Cont, dims::Integer...) = rand(rng, _make_cont(t, Dims(dims)))), |
| 82 | + :(rand( $Cont, dims::Integer...) = rand(GLOBAL_RNG, _make_cont(t, Dims(dims)))), |
| 83 | + |
| 84 | + :(rand(rng::AbstractRNG, X, $Cont, dims::Dims) = rand(rng, _make_cont(t, X, dims))), |
| 85 | + :(rand( X, $Cont, dims::Dims) = rand(GLOBAL_RNG, _make_cont(t, X, dims))), |
| 86 | + :(rand(rng::AbstractRNG, X, $Cont, dims::Integer...) = rand(rng, _make_cont(t, X, Dims(dims)))), |
| 87 | + :(rand( X, $Cont, dims::Integer...) = rand(GLOBAL_RNG, _make_cont(t, X, Dims(dims)))), |
| 88 | + |
| 89 | + :(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Dims) where {X} = rand(rng, _make_cont(t, X, dims))), |
| 90 | + :(rand( ::Type{X}, $Cont, dims::Dims) where {X} = rand(GLOBAL_RNG, _make_cont(t, X, dims))), |
| 91 | + :(rand(rng::AbstractRNG, ::Type{X}, $Cont, dims::Integer...) where {X} = rand(rng, _make_cont(t, X, Dims(dims)))), |
| 92 | + :(rand( ::Type{X}, $Cont, dims::Integer...) where {X} = rand(GLOBAL_RNG, _make_cont(t, X, Dims(dims)))), |
93 | 93 | ] |
94 | 94 | esc(Expr(:block, definitions...)) |
95 | 95 | end |
96 | 96 |
|
| 97 | +_make_cont(args...) = make(args...) |
| 98 | + |
97 | 99 | @make_array_container(t::Type{<:Array}) |
98 | 100 | @make_array_container(t::Type{<:BitArray}) |
99 | 101 | @make_array_container(t::AbstractFloat) |
100 | | - |
| 102 | +_make_cont(t::AbstractFloat, x, dims::Dims) = make(x, t, dims) |
101 | 103 |
|
102 | 104 | ## sets/dicts |
103 | 105 |
|
|
0 commit comments