Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Main {
- private static int r = 0;
- public static void main(String[] args) {
- Random randomGenerator = new Random();
- while (r != 4) { // repeat experiment until r be 4
- if (randomGenerator.nextInt(4) == 2) {
- r++;
- System.out.println("The Count Variable has changed to:" + r);
- }
- if (r == 4) {
- break;
- } else {
- System.out.println("Another unsuccessful trial has occurred, Count value is: " + r);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement