Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package telinc.worldselector;
- import java.util.Random;
- public class WorldSelector {
- private static Random rand = new Random();
- private static int zeroes = 0;
- private static int ones = 0;
- public static void main(String[] args) {
- for(int i = 0; i < 30; i++){
- generatePairs();
- }
- System.out.println("Generated " + zeroes + " zeroes");
- System.out.println("Generated " + ones + " ones");
- }
- private static void generatePairs() {
- for(int i = 0; i < 30; i++){
- int randomNumber = rand.nextInt(2);
- if(randomNumber == 0){
- zeroes++;
- }else{
- ones++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement