Skip to content

Commit

Permalink
Use Random.seed! for testing (Julia 1.0 compatibility)
Browse files Browse the repository at this point in the history
srand has been deprecated in favor of Random.seed!
  • Loading branch information
galenlynch committed Aug 15, 2018
1 parent 7a0315f commit 7cef59f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/cformat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _erfinv(z) = sqrt(π) * Base.Math.@horner(z, 0, 1, 0, π/12, 0, 7π^2/480, 0, 12

function test_equality()
println( "test cformat equality...")
srand(10)
Random.seed!(10)
fmts = [ (x->@sprintf("%10.4f",x), "%10.4f"),
(x->@sprintf("%f", x), "%f"),
(x->@sprintf("%e", x), "%e"),
Expand Down Expand Up @@ -68,20 +68,20 @@ println( "integer sprintf speed, bypass repeated lookup")
@time runtime_int_bypass()

function native_float()
srand( 10 )
Random.seed!( 10 )
for i in 1:200000
@sprintf( "%10.4f", _erfinv( rand() ) )
end
end
function runtime_float()
srand( 10 )
Random.seed!( 10 )
for i in 1:200000
sprintf1( "%10.4f", _erfinv( rand() ) )
end
end
function runtime_float_bypass()
f = generate_formatter( "%10.4f" )
srand( 10 )
Random.seed!( 10 )
for i in 1:200000
f( _erfinv( rand() ) )
end
Expand Down

0 comments on commit 7cef59f

Please sign in to comment.