manual permutation -> ruby permutation