Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Probability {
- public static void main(String[] args) {
- CardDeck deck;
- int success = 0;
- int x = 1;
- int fail;
- for (int i = 0; i < 1000; i++) {
- fail = 0;
- deck = new CardDeck();
- deck.shuffle();
- while (deck.moreCards()) {
- for (x = 1; deck.moreCards(); x++) {
- if (deck.getCard().getRank() == x) {
- fail = 1;
- break;
- }
- if (x == 3) {
- x = 0;
- }
- }
- if (fail == 0) {
- success++;
- }
- }
- }
- System.out.println((double) success / 1000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement