// SetSampledCount sets the SampledCount field's value.
350262
func (s *SamplingStatisticSummary) SetSampledCount(v int64) *SamplingStatisticSummary {
	s.SampledCount = &v
	return s
}
1149030
func (s *SamplingRuleRecord) SetSamplingRule(v *SamplingRule) *SamplingRuleRecord {
	s.SamplingRule = v
	return s
}
1109125
func (s *RecordPatch) SetSyncCount(v int64) *RecordPatch {
	s.SyncCount = &v
	return s
}
574862
func (s *MetricValue) SetCount(v int64) *MetricValue {
	s.Count = &v
	return s
}
1037780
func NewCountingSampler(rate float64) Sampler {
	if rate <= 0 {
		return neverSample
	}
	if rate >= 1.0 {
		return alwaysSample
	}
	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()
		defer mtx.Unlock()
		result := decisions[i]
		i++
		if i == 100 {
			i = 0
		}
		return result
	}
}
289572
func (s *ResourceCount) SetCount(v int64) *ResourceCount {
	s.Count = &v
	return s
}
201309
func (s *InstanceGroupConfig) SetInstanceCount(v int64) *InstanceGroupConfig {
	s.InstanceCount = &v
	return s
}
904462
func (s *RunTaskInput) SetCount(v int64) *RunTaskInput {
	s.Count = &v
	return s
}
127931
func (s *SamplingStatisticSummary) SetRequestCount(v int64) *SamplingStatisticSummary {
	s.RequestCount = &v
	return s
}
1077001
func (s *Command) SetCompletedCount(v int64) *Command {
	s.CompletedCount = &v
	return s
}
1182193
func (w *Waveform) SetSampleFunction(function SampleReduceFunc) error {
	return w.SetOptions(SampleFunction(function))
}
381242
func (s *Bucket) SetCount(v int64) *Bucket {
	s.Count = &v
	return s
}
845446
func (s *StackSummary) SetInstancesCount(v *InstancesCount) *StackSummary {
	s.InstancesCount = v
	return s
}
232450
func (s *InputParallelism) SetCount(v int64) *InputParallelism {
	s.Count = &v
	return s
}
1290854
func (s *SeveritySummary) SetUnspecifiedCount(v int64) *SeveritySummary {
	s.UnspecifiedCount = &v
	return s
}
737062
func (s *MaxCountRule) SetMaxCount(v int64) *MaxCountRule {
	s.MaxCount = &v
	return s
}
225393
func (s *ResourceConfig) SetInstanceCount(v int64) *ResourceConfig {
	s.InstanceCount = &v
	return s
}