fix split shuffle

This commit is contained in:
2025-03-17 04:31:01 -05:00
parent fb650a4086
commit f9f7081fc6
3 changed files with 21 additions and 7 deletions

View File

@@ -63,9 +63,13 @@ class UserKeypad:
self.keypad = dispersed_keypad.reshape(-1)
def split_shuffle(self):
# shuffle all keys
keypad_view = self.keypad_matrix()
np.random.shuffle(keypad_view)
# select half the property sets
prop_permutation = np.random.permutation(self.keypad_size.props_per_key)[: self.keypad_size.props_per_key // 2]
key_permutation = np.random.permutation(self.keypad_size.numb_of_keys)
keypad_view = self.keypad_matrix().copy()
# shuffle the selected property sets to new keys as a group
keypad_view[:, prop_permutation] = keypad_view[key_permutation, :][:, prop_permutation]
self.keypad = keypad_view.reshape(-1)