MCPcopy Create free account
hub / github.com/benbjohnson/immutable / ChooseIndex

Method ChooseIndex

immutable_test.go:284–289  ·  view source on GitHub ↗

ChooseIndex returns a randomly chosen, valid index from the standard slice.

(rand *rand.Rand)

Source from the content-addressed store, hash-verified

282
283// ChooseIndex returns a randomly chosen, valid index from the standard slice.
284func (l *TList) ChooseIndex(rand *rand.Rand) int {
285 if len(l.std) == 0 {
286 return -1
287 }
288 return rand.Intn(len(l.std))
289}
290
291// ChooseSliceIndices returns randomly chosen, valid indices for slicing.
292func (l *TList) ChooseSliceIndices(rand *rand.Rand) (start, end int) {

Callers 1

TestListFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected