Skip to content

Commit d6b882c

Browse files
authored
Remove incorrect rand methods (#297)
The elements of instances of static arrays should be used as the set of items to draw from, as done in `Base`.
1 parent c7d2b2d commit d6b882c

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/arraymath.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ end
5656
end
5757
end
5858

59-
@inline rand(rng::AbstractRNG, range::AbstractArray, ::SA) where {SA <: StaticArray} = rand(rng, range, SA)
6059
@inline rand(rng::AbstractRNG, range::AbstractArray, ::Type{SA}) where {SA <: StaticArray} = _rand(rng, range, Size(SA), SA)
61-
@inline rand(range::AbstractArray, ::SA) where {SA <: StaticArray} = rand(Base.GLOBAL_RNG, range, SA)
6260
@inline rand(range::AbstractArray, ::Type{SA}) where {SA <: StaticArray} = _rand(Base.GLOBAL_RNG, range, Size(SA), SA)
6361
@generated function _rand(rng::AbstractRNG, range::AbstractArray, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
6462
v = [:(rand(rng, range)) for i = 1:prod(s)]
@@ -68,10 +66,8 @@ end
6866
end
6967
end
7068

71-
#@inline rand(rng::MersenneTwister, range::AbstractArray, ::SA) where {SA <: StaticArray} = rand(rng, range, SA)
7269
#@inline rand(rng::MersenneTwister, range::AbstractArray, ::Type{SA}) where {SA <: StaticArray} = _rand(rng, range, Size(SA), SA)
7370

74-
@inline randn(rng::AbstractRNG, ::SA) where {SA <: StaticArray} = randn(rng, SA)
7571
@inline randn(rng::AbstractRNG, ::Type{SA}) where {SA <: StaticArray} = _randn(rng, Size(SA), SA)
7672
@generated function _randn(rng::AbstractRNG, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
7773
T = eltype(SA)
@@ -85,7 +81,6 @@ end
8581
end
8682
end
8783

88-
@inline randexp(rng::AbstractRNG, ::SA) where {SA <: StaticArray} = randexp(rng, SA)
8984
@inline randexp(rng::AbstractRNG, ::Type{SA}) where {SA <: StaticArray} = _randexp(rng, Size(SA), SA)
9085
@generated function _randexp(rng::AbstractRNG, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
9186
T = eltype(SA)

0 commit comments

Comments
 (0)