Skip to content

Commit 8e3ce3c

Browse files
committed
Update handling of srand -> seed change
1 parent 1f268a0 commit 8e3ce3c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/cformat.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
_erfinv(z) = sqrt(π) * Base.Math.@horner(z, 0, 1, 0, π/12, 0, 7π^2/480, 0, 127π^3/40320, 0,
22
4369π^4/5806080, 0, 34807π^5/182476800) / 2
33

4+
set_seed!(seed) = @static V6_COMPAT ? srand(seed) : Random.seed!(seed)
5+
46
function test_equality()
57
println( "test cformat equality...")
6-
Random.seed!(10)
8+
set_seed!(10)
79
fmts = [ (x->@sprintf("%10.4f",x), "%10.4f"),
810
(x->@sprintf("%f", x), "%f"),
911
(x->@sprintf("%e", x), "%e"),
@@ -63,20 +65,20 @@ println( "integer sprintf speed, bypass repeated lookup")
6365
@time runtime_int_bypass()
6466

6567
function native_float()
66-
Random.seed!( 10 )
68+
set_seed!( 10 )
6769
for i in 1:200000
6870
@sprintf( "%10.4f", _erfinv( rand() ) )
6971
end
7072
end
7173
function runtime_float()
72-
Random.seed!( 10 )
74+
set_seed!( 10 )
7375
for i in 1:200000
7476
cfmt( "%10.4f", _erfinv( rand() ) )
7577
end
7678
end
7779
function runtime_float_bypass()
7880
f = generate_formatter( "%10.4f" )
79-
Random.seed!( 10 )
81+
set_seed!( 10 )
8082
for i in 1:200000
8183
f( _erfinv( rand() ) )
8284
end

0 commit comments

Comments
 (0)