// WithMax sets the average and returns the Random.
175176
func (r *Random) WithMax(max float64) *Random {
	r.max = &max
	return r
}
275841
func (s Seq) MinMax() (min, max float64) {
	if s.Len() == 0 {
		return
	}
	min = s.GetValue(0)
	max = min
	var value float64
	for i := 1; i < s.Len(); i++ {
		value = s.GetValue(i)
		if value < min {
			min = value
		}
		if value > max {
			max = value
		}
	}
	return
}
579738
func Max(input Float64Data) (max float64, err error) {

	// Return an error if there are no numbers
	if input.Len() == 0 {
		return math.NaN(), EmptyInputErr
	}

	// Get the first value as the starting point
	max = input.Get(0)

	// Loop and replace higher values
	for i := 1; i < input.Len(); i++ {
		if input.Get(i) > max {
			max = input.Get(i)
		}
	}

	return max, nil
}
554893
func (r *Number) Max(now time.Time) float64 {
	var max float64

	r.Mutex.RLock()
	defer r.Mutex.RUnlock()

	for timestamp, bucket := range r.Buckets {
		// TODO: configurable rolling window
		if timestamp >= now.Unix()-10 {
			if bucket.Value > max {
				max = bucket.Value
			}
		}
	}

	return max
}
744325
func max(values ...int) int {
	v := 0
	for _, i := range values {
		if i > v {
			v = i
		}
	}
	return v
}
75337
func (s *Limit) SetMax(v string) *Limit {
	s.Max = &v
	return s
}
1057492
func WithMaxTargets(maxTargets int) RequestOption {
	return func(ctx context.Client, opts *requestOptions) error {
		opts.MaxTargets = maxTargets
		return nil
	}
}
735475
func (r *DateRule) Max(max time.Time) *DateRule {
	r.max = max
	return r
}
266838
func (ic *IntegerConstraint) ExclusiveMaximum(b bool) *IntegerConstraint {
	ic.NumberConstraint.ExclusiveMaximum(b)
	return ic
}
489325
func (nc *NumberConstraint) Maximum(n float64) *NumberConstraint {
	nc.applyMaximum = true
	nc.maximum = n
	return nc
}
135296
func (xft *XFastTrie) Max() Entry {
	if xft.max == nil {
		return nil
	}

	return xft.max.entry
}
933125
func (s *ArtifactDetails) SetMaximumCount(v int64) *ArtifactDetails {
	s.MaximumCount = &v
	return s
}
153387
func WithMaxAge(d time.Duration) option {
	return func(h *handler) {
		h.maxAge = int(d.Seconds())
		// h.expires = time.Now().Add(d)
	}
}
917490
func WithMaxRetries(b BackOff, max uint64) BackOff {
	return &backOffTries{delegate: b, maxTries: max}
}
901789
func (s *AccountQuota) SetMax(v int64) *AccountQuota {
	s.Max = &v
	return s
}
131048
func (tr *TaskRetry) WithMaxAttempts(maxAttempts int) *TaskRetry {
	tr.MaxAttempts = maxAttempts
	return tr
}
50268
func WithMaxSegmentBytes(max int64) OptionFunc {
	return func(c *CommitLog) error {
		if max > 0 {
			c.maxSegmentBytes = max
		}
		return nil
	}
}