Improve shuffle implementation

Change the implementation of shuffle so interesting patterns are selected first, then a non trivial permutation is done. System for patterns is ment ot be extensible and can be parametrized on the maximum cardinal is wished ot be supported.