Skip to content

Instantly share code, notes, and snippets.

@cnaude
Created May 5, 2016 14:31
Show Gist options
  • Save cnaude/476b30240b80b7be8511a4ea7d4f09e8 to your computer and use it in GitHub Desktop.
Save cnaude/476b30240b80b7be8511a4ea7d4f09e8 to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
randomGenerator = new Random();
int c = 4;
int count = 0;
for (int x = 0; x <= 30; x++) {
int r = randomGenerator.nextInt(100);
if (r >= c) {
System.out.println("Drop: " + r);
} else {
count++;
System.out.println("Keep: " + r);
}
}
System.out.println("Kept " + count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment