Import java.util.random;class card{int suit;//suit char number;//number}public class Pokeshow {static card[] Onecard=new CARD[52]; Save each poker suit, digital static void Showcard ()//show Poker {int i, J; int sign=0; String s= ""; for (i = 0, j = 0; i < K; i++, J + +) {if (J 13==0) {System.out.print ("\ n"); } switch (Onecard[i]. Suit)//display suit symbol {case 1:s= "spades"; sign=3; Break Case 2:s= "Red peach"; sign=4; Break Case 3:s= "Plum"; sign=5; Break Case 4:s= "Block"; sign=6; Break Default:; } System.out.printf ("" +s+onecard[i]. number);//Output display} System.out.print ("\ n");} static void Shuffle ()//algorithm {int i,j,temp;int suit; Card tempcard=new card (); suit=0; for (i = 0; i < i++)//Generate 52 cards {if (i = = 0) {suit++;//change suit} card t=new card (); T.suit = suit;//Save Color temp = i% 13; Switch (temp)//Special value processing {case 0:t.number = ' A '; Break Case 9:t.number = ' 0 '; Break Case 10:t.number = ' J '; Break Case 11:t.number = ' Q '; Break Case 12:t.number = 'K '; Break Default:t.number = (char) (temp + ' 1 '); } onecard[i]=t; } System.out.printf ("The initial arrangement of a new card is as follows: \ n"); Showcard (); Random r=new random ();//stochastic seed for (i = 0; i < K; i++) {j = R.nextint (52);//random card change Tempcard = Onecard[j]; ONECARD[J] = Onecard[i]; Onecard[i] = Tempcard; }}public static void Main (string[] args) {Shuffle ();//Shuffle System.out.print ("\ n Shuffle the following arrangement: \ n"); Showcard ();//Display the new card's Arrangement}}
Card Wash algorithm