Skip to content

Commit

Permalink
Tests: workaround recent changes to randn!
Browse files Browse the repository at this point in the history
This should fix #62 (needs to be tested...).
  • Loading branch information
jipolanco committed Apr 24, 2020
1 parent 0d4a57c commit 8438f37
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ function main()
# Initialise random number generator with deterministic seed (for
# reproducibility).
rng = MersenneTwister(42)
data = randn(rng, Ni, Nj, Nk)

# Workaround recent improvements in randn! for arrays (Julia 1.5).
# See issue #62 and https://github.com/JuliaLang/julia/pull/35078.
# We avoid using the new randn! implementation for arrays, so that the
# results don't change between Julia versions.
data = zeros(Ni, Nj, Nk)
for n in eachindex(data)
data[n] = randn(rng)
end

This comment has been minimized.

Copy link
@rfourquet

rfourquet Apr 24, 2020

Note that you can have a slighly more compact version: data = [randn(rng) for i=1:Ni, j=1:Nj, k=1:Nk].

This comment has been minimized.

Copy link
@jipolanco

jipolanco Apr 24, 2020

Author Member

You're right, I guess that looks better.


# Write 2D and 3D arrays.
@time begin
Expand Down

0 comments on commit 8438f37

Please sign in to comment.