|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.stevesoft.pat.apps.Deck
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.
| Field Summary | |
java.util.Random |
r
The random number generator this class uses. |
| Constructor Summary | |
Deck(int ncards)
Initialize the size of the deck. |
|
| Method Summary | |
void |
discard(int n)
|
int |
draw()
|
int |
ncards()
The number of cards remaining in this object. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public java.util.Random r
| Constructor Detail |
public Deck(int ncards)
| Method Detail |
public int ncards()
public void discard(int n)
public int draw()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||