// Intn returns, as an int, a non-negative pseudo-random number in [0,n).
// It panics if n <= 0.
499602
func (r *Rand) Intn(n int) int {
	if n <= 0 {
		panic("invalid argument to Intn")
	}
	if n <= 1<<31-1 {
		return int(r.Int31n(int32(n)))
	}
	return int(r.Int63n(int64(n)))
}
661233
func MinInt8N(v ...int8) int8 {
	switch len(v) {
	case 0:
		return 0
	case 1:
		return v[0]
	case 2:
		return MinInt8(v[0], v[1])
	default:
		l := len(v) / 2
		return MinInt8N(MinInt8N(v[:l]...), MinInt8N(v[l:]...))
	}
}
756969
func (m *MT19937) IntN(n uint64) uint64 {
	// See if n is out of bounds
	if n <= 0 {
		panic("invalid argument to IntN")
	}
	// Can shortcut Ns that are power of 2
	if n&(n-1) == 0 {
		return m.Int64() & (n - 1)
	}
	t := -n % n // get the threshold
	for {
		r := m.Int64()
		if r >= t {
			return r % n
		}
	}
}
174808
func Int(short string, long string, value int, usage string) *int {
	flagVar := value
	return IntVar(&flagVar, short, long, value, usage)
}
632997
func IndexN(str, sep string, n int) (index int) {
	index, idx, sepLen := 0, -1, len(sep)
	for i := 0; i < n; i++ {
		if idx = strings.Index(str, sep); idx == -1 {
			break
		}
		str = str[idx+sepLen:]
		index += idx
	}

	if idx == -1 {
		index = -1
	} else {
		index += (n - 1) * sepLen
	}

	return
}
1154950
func DigitsN(n int) string {
	digits := make([]rune, n)
	for i := 0; i < n; i++ {
		digits[i] = numeric[r.Intn(len(numeric))]
	}
	return string(digits)
}
77484
func (r *Rand) Int() int {
	u := uint(r.Int63())
	return int(u << 1 >> 1) // clear sign bit if int == int32
}
4210
func (f Flag) Int(name string) (int, error) {
	v, err := f.value(name)
	if err != nil {
		return 0, err
	}

	i, err := strconv.Atoi(v)
	if err != nil {
		return 0, err
	}

	return i, nil
}
904531
func Int(v int) *int32 {
	p := new(int32)
	*p = int32(v)
	return p
}
252535
func Intn(max int) int {
	rng.Lock()
	defer rng.Unlock()
	return rng.rand.Intn(max)
}
1360644
func (a *Array) Int(i int) *Array {
	a.buf = enc.AppendInt(enc.AppendArrayDelim(a.buf), i)
	return a
}
311215
func (lr *LockedRand) Int31n(n int32) (r int32) {
	lr.lk.Lock()
	r = lr.r.Int31n(n)
	lr.lk.Unlock()
	return
}
1087025
func (tr Row) Int64(nn int) (val int64) {
	val, err := tr.Int64Err(nn)
	if err != nil {
		panic(err)
	}
	return
}
1189108
func NumberToInt(n ast.Number) (*big.Int, error) {
	r, ok := new(big.Int).SetString(string(n), 10)
	if !ok {
		return nil, fmt.Errorf("illegal value")
	}
	return r, nil
}
1353902
func PushN(e1, e2 interface{}, n int) error {
	if e1 == nil {
		if e2b, ok := e2.(*Error); ok {
			return e2b.forward(3 + n)
		}
		return newError(e2, 2+n)
	}
	switch val := e1.(type) {
	case *Error:
		return val.push(e2, 3+n)
	case error:
		return newError(val, 2+n).(*Error).push(e2, 3+n)
	case string:
		return newError(val, 2+n).(*Error).push(e2, 3+n)
	default:
		panic("invalid type, e1 must be *Error")
	}
}
1254232
func SetN(n int) Option {
	return func(ngram *NGramIndex) error {
		if n < 2 || n > maxN {
			return errors.New("bad 'n' value for n-gram index")
		}
		ngram.n = n
		return nil
	}
}
58522
func (s *AttributeValue) SetN(v float64) *AttributeValue {
	s.N = &v
	return s
}