v0.3.0-dev-9 #324
@ -37,10 +37,8 @@ internal fun Buffer<Double>.array(): DoubleArray = when (this) {
|
|||||||
is DoubleBuffer -> array
|
is DoubleBuffer -> array
|
||||||
else -> throw RuntimeException("Failed to cast Buffer to DoubleArray")
|
else -> throw RuntimeException("Failed to cast Buffer to DoubleArray")
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
internal inline fun getRandomNormals(n: Int,): DoubleArray {
|
internal inline fun getRandomNormals(n: Int, seed: Long): DoubleArray {
|
||||||
val sampler = BoxMullerNormalizedGaussianSampler.of()
|
val u = Random(seed)
|
||||||
val chain = sampler.sample(RandomGenerator.default)
|
return (0 until n).map { sqrt(-2.0 * ln(u.nextDouble())) * cos(2.0 * PI * u.nextDouble()) }.toDoubleArray()
|
||||||
return (0 until n).map { chain.next() }.toDoubleArray()
|
}
|
||||||
}
|
|
||||||
*/
|
|
Loading…
Reference in New Issue
Block a user