MCPcopy Create free account
hub / github.com/egonelbre/exp / CodeTable2

Function CodeTable2

permutation/code.go:131–148  ·  view source on GitHub ↗
(perm [base]byte)

Source from the content-addressed store, hash-verified

129}
130
131func CodeTable2(perm [base]byte) int {
132 var index [base]byte
133 for i, v := range perm {
134 index[v] = byte(i)
135 }
136
137 r := 0
138 for min := byte(0); min < base-1; min++ {
139 z := index[min]
140 for i, pos := range index {
141 if pos > z {
142 index[i] = pos - 1
143 }
144 }
145 r += int(z) * fact[min]
146 }
147 return r
148}
149
150func CodeShuffle(perm [base]byte) int {
151 var state = [base]byte{

Callers 2

checkFunction · 0.85
BenchmarkTable2Function · 0.85

Calls

no outgoing calls

Tested by 2

checkFunction · 0.68
BenchmarkTable2Function · 0.68