Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2013 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5456730 to your computer and use it in GitHub Desktop.
Save anonymous/5456730 to your computer and use it in GitHub Desktop.
package Roulette;
import java.util.Random;
import java.util.Vector;
public class Wheel {
Vector bins;
Random rng;
Wheel(Random rng){
rng = new Random();
bins = new Vector(38);
for (int i=0; i<38; i++){
bins.add(i, new Bin());
}
}
void addOutcome(int bin, Outcome outcome){
this.bins.elementAt(bin).add(outcome);
}
Bin next(){
int rand = rng.nextInt(38);
return (Bin) bins.elementAt(rand);
}
Bin get(int bin){
return (Bin) bins.elementAt(bin);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment