forked from kscience/kmath
forgot ln
This commit is contained in:
parent
b5d3ca76db
commit
07b6f988c2
@ -38,5 +38,5 @@ internal fun Buffer<Double>.array(): DoubleArray = when (this) {
|
||||
|
||||
internal inline fun getRandomNormals(n: Int, seed: Long): DoubleArray {
|
||||
val u = Random(seed)
|
||||
return (0 until n).map { sqrt(-2.0 * u.nextDouble()) * cos(2.0 * PI * u.nextDouble()) }.toDoubleArray()
|
||||
return (0 until n).map { sqrt(-2.0 * ln(u.nextDouble())) * cos(2.0 * PI * u.nextDouble()) }.toDoubleArray()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user