code: func NewCountingSampler(rate float64) (Sampler, error) {
  	if rate == 0.0 {
  		return NeverSample, nil
  	}
  	if rate == 1.0 {
  		return AlwaysSample, nil
  	}
  	if rate < 0.01 || rate > 1 {
  		return nil, fmt.Errorf("rate should be 0.0 or between 0.01 and 1: was %f", rate)
  	}
  	var (
  		i         = 0
  		outOf100  = int(rate*100 + math.Copysign(0.5, rate*100)) // for rounding float to int conversion instead of truncation
  		decisions = randomBitSet(100, outOf100, rand.New(rand.NewSource(time.Now().UnixNano())))
  		mtx       = &sync.Mutex{}
  	)
  
  	return func(_ uint64) bool {
  		mtx.Lock()
  		result := decisions[i]
  		i++
  		if i == 100 {
  			i = 0
  		}
  		mtx.Unlock()
  		return result
  	}, nil
  }
docs: // NewCountingSampler is appropriate for low-traffic instrumentation or
  // those who do not provision random trace ids. It is not appropriate for
  // collectors as the sampling decision isn't idempotent (consistent based
  // on trace id).