All Packages Class Hierarchy This Package Previous Next Index
Class pat.apps.Deck
java.lang.Object
|
+----pat.apps.Deck
- public class Deck
- extends Object
An interface to java.util.Random which simulates a deck
of "cards." Actually, it just supplies random numbers from
0 to ncards()-1 without ever repeating a number. Thus, you
can think of each integer in this range as a card.
-
r
- The random number generator this class uses.
-
Deck(int)
- Initialize the size of the deck.
-
discard(int)
-
-
draw()
-
-
ncards()
- The number of cards remaining in this object.
r
public Random r
- The random number generator this class uses.
Deck
public Deck(int ncards)
- Initialize the size of the deck. The deck has
a number of cards equal to "ncards" in it.
ncards
public int ncards()
- The number of cards remaining in this object.
discard
public void discard(int n)
draw
public int draw()
All Packages Class Hierarchy This Package Previous Next Index