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

Method ChooseSliceIndices

immutable_test.go:292–299  ·  view source on GitHub ↗

ChooseSliceIndices returns randomly chosen, valid indices for slicing.

(rand *rand.Rand)

Source from the content-addressed store, hash-verified

290
291// ChooseSliceIndices returns randomly chosen, valid indices for slicing.
292func (l *TList) ChooseSliceIndices(rand *rand.Rand) (start, end int) {
293 if len(l.std) == 0 {
294 return 0, 0
295 }
296 start = rand.Intn(len(l.std))
297 end = rand.Intn(len(l.std)-start) + start
298 return start, end
299}
300
301// Append adds v to the end of slice and List.
302func (l *TList) Append(v int) {

Callers 1

TestListFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected