Back to project page pokerdrome.
The source code is released under:
Pokerdrome was released under the GPLv3+ (https://www.gnu.org/licenses/gpl.html) by darlose pokerengine (https://code.google.com/p/pokerengine/) was released under the Apache License 2.0 (https://www...
If you think the Android project pokerdrome listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.darlose.pokerdrome; //w ww . java 2 s . c om import java.util.Random; public class CardDeck { public Card[] cards; private int count; CardDeck() { Random r = new Random(); cards = new Card[52]; count = 0; for(int i=0;i<4;i++) { for(int j=0;j<13;j++) { cards[count] = new Card(Card.Rank.values()[j], Card.Suit.values()[i]); ++count; } } //Fisher-Yates/Knuth shuffling algorithm for(int i=0;i<52;i++) { int j = r.nextInt(51); Card temp = cards[j]; cards[j] = cards[i]; cards[i] = temp; } } public Card[] deal(int dcards) { Card[] dealt = new Card[dcards]; for(int i=0;i<dcards;i++) { dealt[i] = cards[this.count-1]; --this.count; } return dealt; } }