Skip to content

Instantly share code, notes, and snippets.

@daveneedstoknow
Created April 19, 2016 16:29
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 daveneedstoknow/e6f356ebd327865726aeda387f4f5c00 to your computer and use it in GitHub Desktop.
Save daveneedstoknow/e6f356ebd327865726aeda387f4f5c00 to your computer and use it in GitHub Desktop.
import java.util.Random;
public class RouletteWheel {
private final WheelObserver wheelObserver;
private long timeStartMs;
private final Random random = new Random();
public RouletteWheel(final WheelObserver wheelObserver) {
this.wheelObserver = wheelObserver;
}
public void spin(final long timeStartMs) {
this.timeStartMs = timeStartMs;
}
public void tick(final long timeMs) {
if ((timeMs - timeStartMs) >= 20000)
{
final int location = random.nextInt(37);
this.wheelObserver.stopped(location);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment