Throw an exception when xoshiro seed is completely zero
This commit is contained in:
parent
f19804dd4a
commit
1a52864c4e
@ -17,6 +17,15 @@ class Xoshiro256SSRandom(
|
|||||||
) : RandomGenerator, RandomSource {
|
) : RandomGenerator, RandomSource {
|
||||||
private val gaussian = MarsagliaPolarGaussian(this)
|
private val gaussian = MarsagliaPolarGaussian(this)
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(
|
||||||
|
s0 != 0L ||
|
||||||
|
s1 != 0L ||
|
||||||
|
s2 != 0L ||
|
||||||
|
s3 != 0L
|
||||||
|
) { "Xoshiro can't operate with seed being entirely zero" }
|
||||||
|
}
|
||||||
|
|
||||||
constructor(seed: Long) : this(1L, 2L, 3L, 4L) {
|
constructor(seed: Long) : this(1L, 2L, 3L, 4L) {
|
||||||
setSeed(seed)
|
setSeed(seed)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user