(perm [base]byte)
| 129 | } |
| 130 | |
| 131 | func 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 | |
| 150 | func CodeShuffle(perm [base]byte) int { |
| 151 | var state = [base]byte{ |
no outgoing calls