public class Shuffle3 { public static int [] shuffle( int[] x , int k ) { int[] out = new int[53]; int j; for ( int i = 1; i <= 52; i++ ) { k = k%53; j = (i*k)%53; out[j] = x[i]; } return out; } public static void print( int[] x ) { int k = 1; for ( int i = 0; i < 4; i++ ) { for ( int j = 0; j < 13; j++ ) System.out.print(x[k++] + " "); System.out.println(); } System.out.println(); } public static void main( String[] args ) { int i; int[] x = new int[53]; int[] y; int[] z; for ( i = 1; i <= 52; i++ ) x[i] = i; y = shuffle(x, 7 /* 3^10 % 53 */ ); print(y); z = shuffle(y, 38 /* 3^42 % 53 */ ); print(z); } }