// Slice shuffles the slice.
160370
func Slice(slice interface{}) {
	rv := reflect.ValueOf(slice)
	swap := reflect.Swapper(slice)
	n := rv.Len()
	for i := n - 1; i >= 0; i-- {
		j := rand.Intn(i + 1)
		swap(i, j)
	}
}
588517
func (u uintSlice) Swap(i, j int64) {
	u[i], u[j] = u[j], u[i]
}
672464
func (v ByteView) Slice(from, to int) ByteView {
	if v.b != nil {
		return ByteView{b: v.b[from:to]}
	}
	return ByteView{s: v.s[from:to]}
}
61169
func sliceCompress(data []byte) []byte {
	var buf bytes.Buffer
	cmp, _ := zlib.NewWriterLevel(&buf, zlib.BestSpeed)
	cmp.Write(data)
	cmp.Close()
	return buf.Bytes()
}
477886
func (s *slice) Cut(length int) []byte {
	if len(s.bs) < length {
		length = len(s.bs)
		s.err = ErrRead
	}
	val := s.bs[:length]
	s.bs = s.bs[length:]
	return val
}
227673
func InSlice(value, slice interface{}) bool {
	switch reflect.TypeOf(slice).Kind() {
	case reflect.Slice, reflect.Ptr:
		values := reflect.Indirect(reflect.ValueOf(slice))
		if values.Len() == 0 {
			return false
		}

		val := reflect.Indirect(reflect.ValueOf(value))

		if val.Kind() != values.Index(0).Kind() {
			return false
		}

		for i := 0; i < values.Len(); i++ {
			if reflect.DeepEqual(values.Index(i).Interface(), val.Interface()) {
				return true
			}
		}
	}
	return false
}
274362
func ReadSlice(rd io.Reader) (s Slice, err error) {
	// Just in case of programming mistake. Not intentionally used.
	defer func() {
		if r := recover(); r != nil {
			err = errors.New(fmt.Sprint(r))
		}
	}()

	return decodeSlice(rd, "", true)
}
1373550
func (b *buffer) Slice(off, n int) ([]byte, error) {
	end := off + n
	if err := b.fill(end); err != nil {
		return nil, err
	}
	return b.buf[off:end], nil
}
798166
func Convert_Slice_byte_To_Slice_byte(in *[]byte, out *[]byte, s Scope) error {
	if *in == nil {
		*out = nil
		return nil
	}
	*out = make([]byte, len(*in))
	copy(*out, *in)
	return nil
}
1114156
func (mw *memoryWrapper) slice(begin, end int64) []byte {
	if mw.memory.Len() < int(end) {
		// TODO(karalabe): We can't js-throw from Go inside duktape inside Go. The Go
		// runtime goes belly up https://github.com/golang/go/issues/15639.
		log.Warn("Tracer accessed out of bound memory", "available", mw.memory.Len(), "offset", begin, "size", end-begin)
		return nil
	}
	return mw.memory.Get(begin, end-begin)
}
1166935
func slice(path string, start int) (segment string, next int) {
	if len(path) == 0 || start < 0 || start >= len(path) {
		return "", -1
	}
	end := strings.IndexRune(path[start:], '/')
	if end == -1 {
		return path[start:], -1
	}
	if path[start:start+end] == "/" {
		return "", start + end + 1
	}
	return path[start : start+end], start + end + 1
}
583418
func SliceUniq(s []string) []string {
	for i := 0; i < len(s); i++ {
		for i2 := i + 1; i2 < len(s); i2++ {
			if s[i] == s[i2] {
				// delete
				s = append(s[:i2], s[i2+1:]...)
				i2--
			}
		}
	}
	return s
}
681741
func (fc *Flow) Slices(slices [][]interface{}) (ret *Dataset) {

	ret = fc.NewNextDataset(1)
	step := fc.AddOneToOneStep(nil, ret)
	step.IsOnDriverSide = true
	step.Name = "Slices"
	step.Function = func(readers []io.Reader, writers []io.Writer, stat *pb.InstructionStat) error {
		for _, slice := range slices {
			stat.InputCounter++
			err := util.NewRow(util.Now(), slice).WriteTo(writers[0])
			if err != nil {
				return err
			}
			stat.OutputCounter++
		}
		return nil
	}
	return

}
436275
func shuffle(edges []lite.Edge) {
	for i := len(edges) - 1; i > 0; i-- {
		j := rand.Intn(i + 1)
		edges[j], edges[i] = edges[i], edges[j]
	}
}
185411
func (gt *GLTriangles) Slice(i, j int) pixel.Triangles {
	return &GLTriangles{
		vs:     gt.vs.Slice(i, j),
		data:   gt.data[i*gt.vs.Stride() : j*gt.vs.Stride()],
		shader: gt.shader,
	}
}
87769
func (s *Selection) Slice(start, end int) *Selection {
	if start < 0 {
		start += len(s.Nodes)
	}
	if end < 0 {
		end += len(s.Nodes)
	}
	return pushStack(s, s.Nodes[start:end])
}
752240
func shuffle(m []string) {
	for _ = range m {
		i := rand.Intn(len(m))
		j := rand.Intn(len(m))
		m[i], m[j] = m[j], m[i]
	}
}