// pickNoun returns the singular or plural form of a noun depending
// on the count n.
426375
func pickNoun(n int, singular, plural string) string {
	if n == 1 {
		return singular
	}
	return plural
}
650966
func (ug *ug_CN) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
1110219
func (ks *JavaServerSelector) PickServer(key string) (net.Addr, error) {
	if len(ks.addrs) == 0 {
		return nil, mc.ErrNoServers
	}

	if len(ks.addrs) == 1 {
		return ks.addrs[0], nil
	}

	h := hash(key)

	i := sort.Search(len(ks.ring), func(i int) bool {
		return ks.ring[i].hash >= h
	})

	if i == len(ks.ring) {
		i = 0
	}

	return ks.ring[i].addr, nil
}
538527
func (s *stdlogAdapter) pickLevel(str string) (Level, string) {
	switch {
	case strings.HasPrefix(str, "[DEBUG]"):
		return Debug, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[TRACE]"):
		return Trace, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[INFO]"):
		return Info, strings.TrimSpace(str[6:])
	case strings.HasPrefix(str, "[WARN]"):
		return Warn, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[ERROR]"):
		return Error, strings.TrimSpace(str[7:])
	case strings.HasPrefix(str, "[ERR]"):
		return Error, strings.TrimSpace(str[5:])
	default:
		return Info, str
	}
}
364625
func (ha *ha_NE) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
389762
func (nyn *nyn_UG) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
86727
func (w *tableWorker) pickAndExecTask(ctx context.Context) {
	var task *lookupTableTask
	var ok bool
	defer func() {
		if r := recover(); r != nil {
			buf := make([]byte, 4096)
			stackSize := runtime.Stack(buf, false)
			buf = buf[:stackSize]
			logutil.Logger(ctx).Error("tableWorker in IndexLookUpExecutor panicked", zap.String("stack", string(buf)))
			task.doneCh <- errors.Errorf("%v", r)
		}
	}()
	for {
		// Don't check ctx.Done() on purpose. If background worker get the signal and all
		// exit immediately, session's goroutine doesn't know this and still calling Next(),
		// it may block reading task.doneCh forever.
		select {
		case task, ok = <-w.workCh:
			if !ok {
				return
			}
		case <-w.finished:
			return
		}
		err := w.executeTask(ctx, task)
		task.doneCh <- err
	}
}
985588
func (adNoun AdjNoun) Generate() string {
	if adNoun.Format == nil {
		adNoun.Format = GeneratePascalCaseAdjNoun
	}
	return adNoun.Format(adNoun.getAdjective(), adNoun.getNoun(), adNoun.getDigit())
}
1067525
func (nnh *nnh) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
44361
func pickEarliestNonblocking(channels ...chan *models.Task) *models.Task {
	if len(channels) == 0 {
		return nil
	}

	select {
	case job := <-channels[0]:
		return job
	default:
		return pickEarliestNonblocking(channels[1:]...)
	}
}
142045
func (ns *Namespace) Repeat(n, s interface{}) (string, error) {
	ss, err := cast.ToStringE(s)
	if err != nil {
		return "", err
	}

	sn, err := cast.ToIntE(n)
	if err != nil {
		return "", err
	}

	if sn < 0 {
		return "", errors.New("strings: negative Repeat count")
	}

	return _strings.Repeat(ss, sn), nil
}
241202
func chooseN(n uint32, s map[NodeID]*NodeScore) (
	map[NodeID]*NodeScore, error) {

	// Keep track of the number of nodes not yet chosen, in addition to
	// their scores and NodeIDs.
	rem := len(s)
	scores := make([]float64, len(s))
	nodeIDs := make([]NodeID, len(s))
	i := 0
	for k, v := range s {
		scores[i] = v.Score
		nodeIDs[i] = k
		i++
	}

	// Pick a weighted choice from the remaining nodes as long as there are
	// nodes left, and we haven't already picked n.
	chosen := make(map[NodeID]*NodeScore)
	for len(chosen) < int(n) && rem > 0 {
		choice, err := weightedChoice(scores)
		if err == ErrNoPositive {
			return chosen, nil
		} else if err != nil {
			return nil, err
		}

		nID := nodeIDs[choice]

		chosen[nID] = s[nID]

		// We set the score of the chosen node to 0, so it won't be
		// picked the next iteration.
		scores[choice] = 0
	}

	return chosen, nil
}
487125
func (r *Pool) Pick() NumberGenerator {
	// use round robin with fast modulus of pow2 numbers
	selection := atomic.AddUint64(&r.counter, 1) & (r.size - 1)
	return r.sources[selection]
}
155743
func (nn *nn) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
	return locales.PluralRuleUnknown
}
372730
func (s *stack) PickN(n int32) error {
	so, err := s.PeekByteArray(n)
	if err != nil {
		return err
	}
	s.PushByteArray(so)

	return nil
}
1006786
func PickColor() ColorFunc {
	ret := colorsFunc[currentColor]
	currentColor++
	if currentColor > len(colorsFunc) {
		currentColor = 0
	}
	return ret
}
635984
func (s *Statistics) N() uint64 {
	s.RLock()
	defer s.RUnlock()
	return s.samples
}