FileDocCategorySizeDatePackage
RandomBag.javaAPI DocExample769Tue Dec 12 18:58:40 GMT 2000bingo.game

RandomBag

public class RandomBag extends Object implements BagOfBalls

Fields Summary
private boolean
DEBUG
private Vector
balls
private Random
generator
Constructors Summary
RandomBag()


      
	for (int j = BingoBall.MIN; j <= BingoBall.MAX; j++)
	    balls.addElement(new BingoBall(j));
    
Methods Summary
public BingoBallgetNext()

	if (balls.size() > 0) {
	    int num = (int)(generator.nextDouble() * balls.size());
	    BingoBall returnThis = (BingoBall)balls.elementAt(num);
	    balls.removeElementAt(num);
	    return returnThis;
	} else {
	    throw new NoMoreBallsException();
	}