Skip to content

Commit caaeca9

Browse files
lkdvoskshyatt
authored andcommitted
add StableRNG
1 parent 280f38d commit caaeca9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/testsuite/TestSuite.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ using Test, TestExtras
1212
using MatrixAlgebraKit
1313
using MatrixAlgebraKit: diagview
1414
using LinearAlgebra: norm, istriu
15+
using Random, StableRNGs
1516

1617
const tests = Dict()
1718

@@ -27,8 +28,11 @@ end
2728

2829
testargs_summary(args...) = string(args)
2930

30-
instantiate_matrix(::Type{T}, size) where {T <: Number} = randn(T, size)
31-
instantiate_matrix(::Type{AT}, size) where {AT <: Array} = randn(eltype(AT), size)
31+
const rng = StableRNG(123)
32+
seed_rng!(seed) = Random.seed!(rng, seed)
33+
34+
instantiate_matrix(::Type{T}, size) where {T <: Number} = randn(rng, T, size)
35+
instantiate_matrix(::Type{AT}, size) where {AT <: Array} = randn(rng, eltype(AT), size)
3236

3337
precision(::Type{T}) where {T <: Number} = sqrt(eps(real(T)))
3438
precision(::Type{T}) where {T} = precision(eltype(T))

0 commit comments

Comments
 (0)