// SetSamplingRuleRecord sets the SamplingRuleRecord field's value.
13076
func (s *UpdateSamplingRuleOutput) SetSamplingRuleRecord(v *SamplingRuleRecord) *UpdateSamplingRuleOutput {
	s.SamplingRuleRecord = v
	return s
}
1048554
func (s *MetricAlarm) SetEvaluateLowSampleCountPercentile(v string) *MetricAlarm {
	s.EvaluateLowSampleCountPercentile = &v
	return s
}
198273
func ConvertSampleRate(srcSamples []int32, srcSampleRate, dstSampleRate int) (dstSamples []int32, err error) {
	// Do nothing
	if srcSampleRate == dstSampleRate {
		dstSamples = srcSamples
		return
	}

	// For now we don't handle data loss
	if srcSampleRate < dstSampleRate {
		err = errors.New("astiaudio: src sample rate < dst sample rate")
		return
	}

	// Get ratio
	ratio := float64(srcSampleRate) / float64(dstSampleRate)

	// Loop
	var idx float64
	for {
		// Take floor of index
		floor := int(math.Floor(idx))

		// Out of range
		if floor >= len(srcSamples) {
			break
		}

		// Append sample
		dstSamples = append(dstSamples, srcSamples[floor])

		// Increment index
		idx += ratio
	}
	return
}
583544
func (s *BatchMeterUsageInput) SetUsageRecords(v []*UsageRecord) *BatchMeterUsageInput {
	s.UsageRecords = v
	return s
}
591452
func (a *AvgSampleWithMin) GetSampleRate(key string) int {
	a.lock.Lock()
	defer a.lock.Unlock()
	a.currentCounts[key]++
	if !a.haveData {
		return a.GoalSampleRate
	}
	if rate, found := a.savedSampleRates[key]; found {
		return rate
	}
	return 1
}
176568
func (s *SamplingStatisticsDocument) SetSampledCount(v int64) *SamplingStatisticsDocument {
	s.SampledCount = &v
	return s
}
489327
func (s *MethodSetting) SetThrottlingBurstLimit(v int64) *MethodSetting {
	s.ThrottlingBurstLimit = &v
	return s
}
1342361
func AddSample(key []string, val float32) {
	normalizeKeys(key)

	GetMetrics().AddSample(key, val)
}
1321246
func (hook *SentryHook) SetSampleRate(rate float32) error {
	return hook.client.SetSampleRate(rate)
}
633261
func (o *OnlyOnce) GetSampleRate(key string) int {
	o.lock.Lock()
	defer o.lock.Unlock()
	if _, found := o.seen[key]; found {
		return 1000000000
	}
	o.seen[key] = true
	return 1
}
294502
func (s *SamplingRuleUpdate) SetRuleARN(v string) *SamplingRuleUpdate {
	s.RuleARN = &v
	return s
}
1070971
func NewGuaranteedThroughputProbabilisticSampler(
	lowerBound, samplingRate float64,
) (*GuaranteedThroughputProbabilisticSampler, error) {
	return newGuaranteedThroughputProbabilisticSampler(lowerBound, samplingRate), nil
}
1009258
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
}
544247
func (s *SimpleScalingPolicyConfiguration) SetScalingAdjustment(v int64) *SimpleScalingPolicyConfiguration {
	s.ScalingAdjustment = &v
	return s
}
4862
func (s *Mp2Settings) SetSampleRate(v float64) *Mp2Settings {
	s.SampleRate = &v
	return s
}
353423
func (a *StartSamplingArgs) SetSamplingInterval(samplingInterval float64) *StartSamplingArgs {
	a.SamplingInterval = &samplingInterval
	return a
}
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
	}
}