Skip to content

Commit ab5b768

Browse files
committed
test: use isolated RandomState in linear algebra tests
Convert remaining np.random.randn calls to use isolated RandomState: - np.dot.Test.cs: Dot30_300x30_300 test - MatMulInt64Tests.cs: Dot_LargeContiguousArrays test Ensures test isolation for parallel execution.
1 parent 3264583 commit ab5b768

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

test/NumSharp.UnitTest/LinearAlgebra/MatMulInt64Tests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ public async Task MatMul_Int64_Correct()
247247
public async Task Dot_LargeContiguousArrays()
248248
{
249249
// Test with larger arrays to ensure SIMD path handles size correctly
250-
var a = np.random.randn(100, 100);
251-
var b = np.random.randn(100, 100);
250+
var rng = np.random.RandomState(42);
251+
var a = rng.randn(100, 100);
252+
var b = rng.randn(100, 100);
252253

253254
// Should not throw
254255
var result = np.dot(a, b);

test/NumSharp.UnitTest/LinearAlgebra/np.dot.Test.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ public void Dot2x3And3x2()
101101
[OpenBugs] // RNG IndexOutOfRangeException in MT19937
102102
public void Dot30_300x30_300()
103103
{
104-
var a = np.random.randn(30, 300);
105-
var b = np.random.randn(300, 30);
104+
var rng = np.random.RandomState(42);
105+
var a = rng.randn(30, 300);
106+
var b = rng.randn(300, 30);
106107
var c = np.dot(a, b);
107108
}
108109
}

0 commit comments

Comments
 (0)