Last active
March 25, 2019 10:12
-
-
Save shalk/1574fe9e54870b4c11a99e603ac1e337 to your computer and use it in GitHub Desktop.
Coin4j
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; | |
import java.util.concurrent.TimeUnit; | |
public class Coin { | |
public static void main(String[] args) throws InterruptedException { | |
String[] candidates = new String[]{"π", "π", "π", "π", "π", "π", "π", "π"}; | |
Random r = new Random(); | |
for (int i = 0; i < 3; i++) { | |
for (String s : candidates) { | |
System.out.print(s); | |
TimeUnit.MILLISECONDS.sleep(42); | |
System.out.print("\b\b"); | |
} | |
} | |
System.out.println(r.nextBoolean() ? "π" : "π"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment