This commit is contained in:
EfveZombie 2025-06-20 15:31:50 -04:00 committed by GitHub
commit 57691186be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -1866,12 +1866,12 @@ func fastexprand(mean int) int32 {
return 0
}
// Take a random sample of the exponential distribution exp(-mean*x).
// The probability distribution function is mean*exp(-mean*x), so the CDF is
// p = 1 - exp(-mean*x), so
// q = 1 - p == exp(-mean*x)
// log_e(q) = -mean*x
// -log_e(q)/mean = x
// Take a random sample of the exponential distribution exp(-x/mean).
// The probability distribution function is exp(-x/mean)/mean, so the CDF is
// p = 1 - exp(-x/mean), so
// q = 1 - p == exp(-x/mean)
// log_e(q) = -x/mean
// -log_e(q) * mean = x
// x = -log_e(q) * mean
// x = log_2(q) * (-log_e(2)) * mean ; Using log_2 for efficiency
const randomBitCount = 26