Skip to content

Instantly share code, notes, and snippets.

@bholzer
Created April 26, 2012 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bholzer/2500528 to your computer and use it in GitHub Desktop.
Save bholzer/2500528 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Card{
private static String[] pairArray={"A,A","K,K","Q,Q","J,J","10,10","9,9","8,8","7,7","6,6","5,5","4,4","3,3","2,2"};
public static void generateRandom(int k){
int minimum = 0;
int maximum = 13;
for(int i = 1; i <= k; i++)
{
int randomNum = minimum + (int)(Math.random()* maximum);
System.out.print("Player " + i +" , You have been dealt a pair of: ");
System.out.println(pairArray[randomNum]);
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("How many players? ");
int m = scan.nextInt();
generateRandom(m);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment