// rangeBetween returns bitmaps with a bsiGroup value encoding matching any value between predicateMin and predicateMax.
192044
func (f *fragment) rangeBetween(bitDepth uint, predicateMin, predicateMax uint64) (*Row, error) {
	b := f.row(uint64(bitDepth))
	keep1 := NewRow() // GTE
	keep2 := NewRow() // LTE

	// Filter any bits that don't match the current bit value.
	for i := int(bitDepth - 1); i >= 0; i-- {
		row := f.row(uint64(i))
		bit1 := (predicateMin >> uint(i)) & 1
		bit2 := (predicateMax >> uint(i)) & 1

		// GTE predicateMin
		// If bit is set then remove all unset columns not already kept.
		if bit1 == 1 {
			b = b.Difference(b.Difference(row).Difference(keep1))
		} else {
			// If bit is unset then add columns with set bit to keep.
			// Don't bother to compute this on the final iteration.
			if i > 0 {
				keep1 = keep1.Union(b.Intersect(row))
			}
		}

		// LTE predicateMin
		// If bit is zero then remove all set bits not in excluded bitmap.
		if bit2 == 0 {
			b = b.Difference(row.Difference(keep2))
		} else {
			// If bit is set then add columns for set bits to exclude.
			// Don't bother to compute this on the final iteration.
			if i > 0 {
				keep2 = keep2.Union(b.Difference(row))
			}
		}
	}

	return b, nil
}
138781
func (c *dlchunk) ByteRange() string {
	if len(c.withRange) != 0 {
		return c.withRange
	}

	return fmt.Sprintf("bytes=%d-%d", c.start, c.start+c.size-1)
}
1340196
func Float64Range(min, max float64) gopter.Gen {
	d := max - min
	if d < 0 || d > math.MaxFloat64 {
		return Fail(reflect.TypeOf(float64(0)))
	}

	return func(genParams *gopter.GenParameters) *gopter.GenResult {
		genResult := gopter.NewGenResult(min+genParams.Rng.Float64()*d, Float64Shrinker)
		genResult.Sieve = func(v interface{}) bool {
			return v.(float64) >= min && v.(float64) <= max
		}
		return genResult
	}
}
257647
func IsInRange(value int, min int, max int) []string {
	if value >= min && value <= max {
		return nil
	}
	return []string{InclusiveRangeError(min, max)}
}
795099
func UInt16Range(min, max uint16) gopter.Gen {
	return UInt64Range(uint64(min), uint64(max)).
		Map(uint64To16).
		WithShrinker(UInt16Shrinker).
		SuchThat(func(v uint16) bool {
			return v >= min && v <= max
		})
}
813218
func parseLexrange(s string) (string, bool, error) {
	if len(s) == 0 {
		return "", false, errInvalidRangeItem
	}
	if s == "+" || s == "-" {
		return s, false, nil
	}
	switch s[0] {
	case '(':
		return s[1:], false, nil
	case '[':
		return s[1:], true, nil
	default:
		return "", false, errInvalidRangeItem
	}
}
331935
func (v *VerbalExpression) Range(args ...interface{}) *VerbalExpression {
	if len(args)%2 != 0 {
		log.Panicf("Range: not even args number")
	}

	parts := make([]string, 3)
	app := ""
	for i := 0; i < len(args); i++ {
		app += tostring(args[i])
		if i%2 != 0 {
			parts = append(parts, quote(app))
			app = ""
		} else {
			app += "-"
		}
	}
	return v.add("[" + strings.Join(parts, "") + "]")
}
466228
func (ac *arrayContainer) iaddRange(firstOfRange, endx int) container {
	if firstOfRange >= endx {
		return ac
	}
	indexstart := binarySearch(ac.content, uint16(firstOfRange))
	if indexstart < 0 {
		indexstart = -indexstart - 1
	}
	indexend := binarySearch(ac.content, uint16(endx-1))
	if indexend < 0 {
		indexend = -indexend - 1
	} else {
		indexend++
	}
	rangelength := endx - firstOfRange
	newcardinality := indexstart + (ac.getCardinality() - indexend) + rangelength
	if newcardinality > arrayDefaultMaxSize {
		a := ac.toBitmapContainer()
		return a.iaddRange(firstOfRange, endx)
	}
	if cap(ac.content) < newcardinality {
		tmp := make([]uint16, newcardinality, newcardinality)
		copy(tmp[:indexstart], ac.content[:indexstart])
		copy(tmp[indexstart+rangelength:], ac.content[indexend:])

		ac.content = tmp
	} else {
		ac.content = ac.content[:newcardinality]
		copy(ac.content[indexstart+rangelength:], ac.content[indexend:])

	}
	for k := 0; k < rangelength; k++ {
		ac.content[k+indexstart] = uint16(firstOfRange + k)
	}
	return ac
}
578015
func (b Bitmap) IndexesInRange(set bool, from, to uint) []int {
	var indexes []int
	for i := from; i <= to && i < b.Size(); i++ {
		c := b.Check(i)
		if c && set || !c && !set {
			indexes = append(indexes, int(i))
		}
	}

	return indexes
}
673985
func (s *SkipList) Range(from, to interface{}) Iterator {
	start := s.getPath(s.header, nil, from)
	return &rangeIterator{
		iter: iter{
			current: &node{
				forward:  []*node{start},
				backward: start,
			},
			list: s,
		},
		upperLimit: to,
		lowerLimit: from,
	}
}
658776
func LogarithmicRange(min, max int, cb func(int)) {
	if min == 0 {
		min = 1
	}
	for n := CeilToPowerOfTwo(min); n <= max; n <<= 1 {
		cb(n)
	}
}
276183
func valueRange(a, b, base int) []int {
	value := make([]int, absoluteOverBreakpoint(a, b, base)+1)
	i := 0
	for ; a != b; a++ {
		if a == base {
			a = 0
		}
		value[i] = a
		i++
	}
	value[i] = a
	return value
}
593472
func (ung UniformGenerator) Float32Range(a, b float32) float32 {
	if !(a < b) {
		panic(fmt.Sprintf("Invalid range: %.2f ~ %.2f", a, b))
	}
	return a + ung.Float32()*(b-a)
}
1203365
func (ung UniformGenerator) Int64Range(a, b int64) int64 {
	if b <= a {
		panic(fmt.Sprintf("Illegal parameter a, b: %d, %d", a, b))
	}
	if b-a > math.MaxInt32 {
		panic(fmt.Sprintf("Illegal parameter a, b: %d, %d", a, b))
	}
	return a + ung.Int64n(b-a)
}
229217
func (g *UndirectedGraph) HasEdgeBetween(x, y graph.Node) bool {
	_, ok := g.edges[x.ID()].Get(y.ID())
	return ok
}
836994
func (gc *Cfg) CheckInBitRange(ranges, inUse, pktTagType string) bool {

	tags := strings.Split(inUse, ",")

	if len(inUse) == 0 {
		return true
	}
	minUsed := 0
	maxUsed := 0
	if strings.Contains(tags[0], "-") {
		minUsed, _ = strconv.Atoi(strings.Split(tags[0], "-")[0])
		maxUsed, _ = strconv.Atoi(strings.Split(tags[0], "-")[1])
	} else {
		minUsed, _ = strconv.Atoi(tags[0])
		maxUsed = minUsed
	}

	if len(inUse) > 1 {
		if strings.Contains(tags[len(tags)-1], "-") {
			maxUsed, _ = strconv.Atoi(strings.Split(tags[len(tags)-1], "-")[1])
		} else {
			maxUsed, _ = strconv.Atoi(strings.TrimSpace(tags[len(tags)-1]))
		}
	}

	r, err := netutils.ParseTagRanges(ranges, pktTagType)
	if err != nil {
		return false
	}

	if r[0].Min > minUsed || r[0].Max < maxUsed {
		return false
	}
	return true
}
475809
func (g *UndirectedGraph) EdgeBetween(x, y graph.Node) graph.Edge {
	// We don't need to check if neigh exists because
	// it's implicit in the edges access.
	if !g.Has(x) {
		return nil
	}

	edge, _ := g.edges[x.ID()].Get(y.ID())
	return edge
}