Skip to content

Commit 0ab751e

Browse files
committed
prevent unnecessary dynamic vector construction in randn
1 parent 7747c98 commit 0ab751e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/extras/random.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ function randn(rng::AbstractRNG, ::Type{DoubleFloat{T}}) where {T<:IEEEFloat}
8585
urand1, urand2, s = ntuple(i -> zero(DoubleFloat{T}), Val{3}())
8686

8787
while true
88-
urand1, urand2 = rand(rng, DoubleFloat{T}, 2)
88+
urand1 = rand(rng, DoubleFloat{T})
89+
urand2 = rand(rng, DoubleFloat{T})
8990
urand1 = urand1 + urand1 - 1
9091
urand2 = urand2 + urand2 - 1
9192
s = urand1*urand1 + urand2*urand2

0 commit comments

Comments
 (0)