File: default.go

package info (click to toggle)
golang-github-codesenberg-concurrent 0.0~git20180531.64560cf-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 192 kB
  • sloc: makefile: 2
file content (16 lines) | stat: -rw-r--r-- 453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package histogram

import "github.com/codesenberg/concurrent/float64/hash"

// WithDefaultHash creates histogram with specified shardCount and
// reasonable sharding function.
func WithDefaultHash(shardsCount uint32) (*Histogram, error) {
	return New(shardsCount, hash.Float64)
}

// Default creates histogram with reasonable defaults.
func Default() *Histogram {
	// We can safely ignore the error in this case
	h, _ := WithDefaultHash(32)
	return h
}