// UniqInt creates an array of int with unique values.
548445
func UniqInt(a []int) []int {
	length := len(a)

	seen := make(map[int]struct{}, length)
	j := 0

	for i := 0; i < length; i++ {
		v := a[i]

		if _, ok := seen[v]; ok {
			continue
		}

		seen[v] = struct{}{}
		a[j] = v
		j++
	}

	return a[0:j]
}
1204359
func getUniqueCoreID(threads []int) (coreID int, err error) {
	if len(threads) == 0 {
		return 0, fmt.Errorf("no cpus provided")
	}

	if len(threads) != cpuset.NewCPUSet(threads...).Size() {
		return 0, fmt.Errorf("cpus provided are not unique")
	}

	min := threads[0]
	for _, thread := range threads[1:] {
		if thread < min {
			min = thread
		}
	}

	return min, nil
}
399611
func RandomInt(min, max int) int {
	return min + rand.Intn(max-min)
}
582503
func (m mathUtil) SumInt(values ...int) int {
	var total int
	for _, v := range values {
		total += v
	}
	return total
}
1360644
func (a *Array) Int(i int) *Array {
	a.buf = enc.AppendInt(enc.AppendArrayDelim(a.buf), i)
	return a
}
843333
func (a UnsignedValues) Deduplicate() UnsignedValues {
	if len(a) <= 1 {
		return a
	}

	// See if we're already sorted and deduped
	var needSort bool
	for i := 1; i < len(a); i++ {
		if a[i-1].UnixNano() >= a[i].UnixNano() {
			needSort = true
			break
		}
	}

	if !needSort {
		return a
	}

	sort.Stable(a)
	var i int
	for j := 1; j < len(a); j++ {
		v := a[j]
		if v.UnixNano() != a[i].UnixNano() {
			i++
		}
		a[i] = v

	}
	return a[:i+1]
}
864364
func ShuffleInt32(a []int32) []int32 {
	for i := range a {
		j := rand.Intn(i + 1)
		a[i], a[j] = a[j], a[i]
	}

	return a
}
600335
func (ta *Table) UniqueIndexes() int {
	unique := 0
	for _, idx := range ta.Indexes {
		if idx.Unique {
			unique++
		}
	}
	return unique
}
1293798
func (c *Config) uniquappend(conf string) bool {
	for _, v := range c.conflist {
		for k, _ := range v {
			if k == conf {
				return false
			}
		}
	}
	return true
}
1360377
func (lr *LockedRand) Int() (n int) {
	lr.lk.Lock()
	n = lr.r.Int()
	lr.lk.Unlock()
	return
}
1132054
func (oi *OsqueryInt) UnmarshalJSON(buff []byte) error {
	s := string(buff)
	if strings.Contains(s, `"`) {
		unquoted, err := strconv.Unquote(s)
		if err != nil {
			return &json.UnmarshalTypeError{
				Value:  string(buff),
				Type:   reflect.TypeOf(oi),
				Struct: "statuses",
			}
		}
		s = unquoted
	}

	if len(s) == 0 {
		*oi = OsqueryInt(0)
		return nil
	}

	parsedInt, err := strconv.ParseInt(s, 10, 32)
	if err != nil {
		return &json.UnmarshalTypeError{
			Value:  string(buff),
			Type:   reflect.TypeOf(oi),
			Struct: "statuses",
		}
	}

	*oi = OsqueryInt(parsedInt)
	return nil
}
1264814
func (s *regexFcd) pushInt(I int) {
	if s.intDepth >= len(s.intStack) {
		expanded := make([]int, s.intDepth*2)
		copy(expanded, s.intStack)
		s.intStack = expanded
	}

	s.intStack[s.intDepth] = I
	s.intDepth++
}
1108567
func Uniquify(inp []string) []string {
	m := make(map[string]bool)
	for _, s := range inp {
		m[strings.ToLower(s)] = true
	}
	ret := make([]string, 0, len(m))
	for k := range m {
		ret = append(ret, k)
	}
	return ret
}
25982
func Uniq(in interface{}) interface{} {
	value := reflect.ValueOf(in)
	valueType := value.Type()

	kind := value.Kind()

	if kind == reflect.Array || kind == reflect.Slice {
		length := value.Len()

		seen := make(map[interface{}]bool, length)
		j := 0

		for i := 0; i < length; i++ {
			val := value.Index(i)
			v := val.Interface()

			if _, ok := seen[v]; ok {
				continue
			}

			seen[v] = true
			value.Index(j).Set(val)
			j++
		}

		return value.Slice(0, j).Interface()
	}

	panic(fmt.Sprintf("Type %s is not supported by Uniq", valueType.String()))
}
920404
func NewIntValue(i int) Value {
	value := &Value{}
	value.StoreInt(i)
	return *value
}
1109949
func ReverseInt(s []int) []int {
	for i, j := 0, len(s)-1; i < len(s)/2; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}
236021
func unaryOpRatiomidi(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpRatiomidi, numOutputs, in)
}