Shuffle apparatus implemented by Java and JS

I just learned Java and JavaScript, simply wrote a small program with Java and JavaScript

JavaScript

  // AN Highlighted blockvar colors = ['红', 'plum ",' square tablet ',' 黑 '] var number = [' 2 ',' 3 ',' 4 ',' 5 ',' 6 ',' 7 ',' 8 ',' 9 ',' K ',' A '] VAR PUKE = New Array (); var cards = new array (); for (VAR i = 0; i < 52; i++){
  cards[i] = i
}
console.log("洗牌前");
for (var i = 0; i < 52; i++) {
  puke [i] = colors[parseInt(cards[i]/13)]+numbers[cards[i]%13]

}
console.log(puke)
console.log("洗牌后")
puke.sort(function () {
  return 0.5-Math.random()
})
console.log(puke) 
Java

public class puke {public static void main (string [] args) {// Todo Auto-generated method stub string colors [] = {“黑”, “red peach”, “plum flower”, “square film”}; string word [] = {“2”, “3”, ” 4 “,” 5 “,” 6 “,” 7 “,” 8 “,” 9 “,” 10 “,” J “,” Q “,” K “,” A “}; string [] cards = new String [52]; System.out.Println (“Shipwash: \ n”); for (int i = 0; i
  < 52; i++) {
  cards[i] = colors[i/13] + words[i%13];
  if (i%13==0) {
  System.out.println();
  }
  System.out.print(" "+cards[i]);
 }
    System.out.println();
    System.out.println("洗牌后");
    String str;
    for(int i=0;i<cards.length;i++){
      int e=(int) Math.round((cards.length-1)*Math.random());
      str=cards[e];
      cards[e]=cards[cards.length-1];
      cards[cards.length-1]=str;
     }
    for (int i = 0; i < 52; i++) { 
  if (i%13==0) {
  System.out.println();
  }
  System.out.print(" "+cards[i]);
 }
 }
} 
summary

The above is the shuffle applet implementation of Java and JS, which is given to you, I hope that everyone will help, if you have any questions, please leave a message, Xiaobian will reply to everyone. I am very grateful to TU here.Mi Cloud website support! If you think this article helps you, welcome to reprint, please indicate the source, thank you!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment