Improve comment formatting

This commit is contained in:
Alan Bernstein 2016-12-19 13:56:06 -06:00
parent 2968c15a37
commit 9ae006908a
2 changed files with 9 additions and 10 deletions

View file

@ -48,9 +48,9 @@ func LCGmultiplierFromModulus(m int64, seed int64) int64 {
return product*seed + 1
}
// Returns map of {integerFactor: count, ...}
// This is a naive algorithm that will not work well for large prime n.
func primeFactors(n int64) map[int64]int {
// Returns map of {integerFactor: count, ...}
// This is a naive algorithm that will not work well for large prime n.
factors := make(map[int64]int)
for i := int64(2); i <= n; i++ {
div, mod := n/i, n%i

View file

@ -109,15 +109,14 @@ func (b *ZipfSetBits) ConsumeFlags(args []string) ([]string, error) {
return fs.Args(), nil
}
// Offset is the true parameter used by the Zipf distribution, but the ratio,
// as defined here, is a simpler, readable way to define the distribution.
// Offset is in [1, inf), and its meaning depends on N (a pain for updating benchmark configs)
// ratio is in (0, 1), and its meaning does not depend on N.
// it is the ratio of the lowest probability in the distribution to the highest.
// ratio=0.01 corresponds to a very small offset - the most skewed distribution for a given pair (N, exp)
// ratio=0.99 corresponds to a very large offset - the most nearly uniform distribution for a given (N, exp)
func getZipfOffset(N int64, exp, ratio float64) float64 {
// Offset is the true parameter used by the Zipf distribution, but the ratio,
// as defined here, is a simpler, readable way to define the distribution.
// Offset is in [1, inf), and its meaning depends on N (a pain for updating benchmark configs)
// ratio is in (0, 1), and its meaning does not depend on N.
// it is the ratio of the lowest probability in the distribution to the highest.
// ratio=0.01 corresponds to a very small offset - the most skewed distribution for a given pair (N, exp)
// ratio=0.99 corresponds to a very large offset - the most nearly uniform distribution for a given (N, exp)
z := math.Pow(ratio, 1/exp)
return z * float64(N-1) / (1 - z)
}