The example of this article tells the way Java achieves shuffling cards. Share it for everyone for your reference. The specifics are as follows:
Import Java.util.*; Public Class main { / ***@param ARGS The Command Line Arguments* / Static int Numbersofplayers = 4; Static into 13; Public Static Void Main (String [] args) {// Todo CODE Application Logic Here String [] Player = {"Xiao Wang", "Xiao Zhang", "Xiao Zhao", "Xiao Bai"}; String Sentence = "is:"; string [] huase = {"♥" ♥ ",", ",", "," ♠ "}; string [] PAIVALUE = {" a "," 2 "," 3 "," 5 "," 6 "," 7 "," 8 "," 9 "," 10 "," j "," q "," k "}; list deak = new arrayList (); for (int i = 0; i <4; i ++) {for (int j" = 0; j <13; j ++) {deak.add (huase [i]+PAIVALUE [j]);}} Collections.shuffle (Deak); for (int i = 0; I <numbersofplayers; I ++) {systemm. Out.print (Player [i]+Sentence); System.out.println (DealHand (Deak, Numbersofhandcard)); i = ls.size (); List handView = ls.sublist (SIZEPAI -N, SIZEPAI); list hand = new arraylist (handView); handView.clear (); Return hand;}}It is hoped that this article is helpful to everyone's Java program design.