MCPcopy Create free account
hub / github.com/cogentcore/core / Permuted

Method Permuted

tensor/table/indexview.go:90–102  ·  view source on GitHub ↗

Permuted sets indexes to a permuted order -- if indexes already exist then existing list of indexes is permuted, otherwise a new set of permuted indexes are generated

()

Source from the content-addressed store, hash-verified

88// then existing list of indexes is permuted, otherwise a new set of
89// permuted indexes are generated
90func (ix *IndexView) Permuted() {
91 if ix.Table == nil || ix.Table.Rows <= 0 {
92 ix.Indexes = nil
93 return
94 }
95 if len(ix.Indexes) == 0 {
96 ix.Indexes = rand.Perm(ix.Table.Rows)
97 } else {
98 rand.Shuffle(len(ix.Indexes), func(i, j int) {
99 ix.Indexes[i], ix.Indexes[j] = ix.Indexes[j], ix.Indexes[i]
100 })
101 }
102}
103
104// AddIndex adds a new index to the list
105func (ix *IndexView) AddIndex(idx int) {

Callers 1

PermutedFunction · 0.80

Calls 2

PermMethod · 0.65
ShuffleMethod · 0.65

Tested by

no test coverage detected