-
-
Save daveneedstoknow/e6f356ebd327865726aeda387f4f5c00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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