util

package
v0.0.0-...-0bb1e2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRandomIndices

func GetRandomIndices(indiceCount, highestIndex int) []int

GetRandomIndices returns indiceCount random indices from 0 to highestIndex.

func IndexInSlice

func IndexInSlice(array interface{}, o interface{}, equals Equals) int

IndexInSlice returns the index of given object o in array, and -1 if it is not in array.

func RandomInt

func RandomInt(n int) int

RandomInt returns, as an int, a non-negative pseudo-random integer in [0,n) It panics if n <= 0

func RandomUInt64

func RandomUInt64() uint64

RandomUInt64 returns a random uint64

If we want a rand that's non-global and specific to gossip, we can establish one. Otherwise this uses the process-global locking RNG.

Types

type Equals

type Equals func(a interface{}, b interface{}) bool

Equals returns whether a and b are the same

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is a generic and thread-safe set container

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL