func ProbabilitySampler(fraction float64) Sampler {
	if !(fraction >= 0) {
		fraction = 0
	} else if fraction >= 1 {
		return AlwaysSample()
	}
	return probabilitySampler{
		traceIDUpperBound: uint64(fraction * (1 << 63)),
	}
}
ProbabilitySampler returns a Sampler that samples a given fraction of traces.

It also samples spans whose parents are sampled.
package trace
import (
	"encoding/binary"
)
const defaultSamplingProbability = 1e-4
var defaultSampler Sampler
func init() {
	defaultSampler = newDefaultSampler()
}
func newDefaultSampler() Sampler {
	return ProbabilitySampler(defaultSamplingProbability)
}
func SetDefaultSampler(sampler Sampler) {
	if sampler == nil {
		sampler = newDefaultSampler()
	}
	mu.Lock()
	defaultSampler = sampler
	mu.Unlock()
}
type Sampler interface {
	Sample(p SamplingParameters) SamplingDecision
}
type SamplingParameters struct {
	ParentContext SpanContext
	TraceID
	SpanID
	Name            string
	HasRemoteParent bool
}
type SamplingDecision struct {
	Sample bool
}