Skip to content

Commit 677fa15

Browse files
committed
fix XoShiRo256StarStar seeding bug
1 parent f26661d commit 677fa15

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/net/jamu/matrix/XoShiRo256StarStar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 Stefan Zobel
2+
* Copyright 2023, 2024 Stefan Zobel
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818
import java.security.NoSuchAlgorithmException;
1919
import java.security.SecureRandom;
2020
import java.util.Random;
21+
import java.util.SplittableRandom;
2122

2223
/**
2324
* 256-bit {@code xoshiro256**} pseudo random generator suggested by
@@ -289,8 +290,7 @@ public long nextLong(long bound) {
289290
}
290291

291292
private void init(long nextSeed) {
292-
SecureRandom rnd = getSecureRandom();
293-
rnd.setSeed(nextSeed);
293+
SplittableRandom rnd = new SplittableRandom(nextSeed);
294294
x0 = rnd.nextLong();
295295
x1 = rnd.nextLong();
296296
x2 = rnd.nextLong();

0 commit comments

Comments
 (0)