-
-
Save anonymous/358f1fff12e5f0a95789d373c9288a76 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
//******************************************************************* | |
// Dear CompileJava users, | |
// | |
// CompileJava has been operating since 2013 completely free. If you | |
// find this site useful, or would otherwise like to contribute, then | |
// please consider a donation (link in 'More Info' tab) to support | |
// development of the new CompileJava website (stay tuned!). | |
// | |
// Most sincerely, Z. | |
//******************************************************************* | |
import java.util.Random; | |
public class MainClass { | |
public static void main(String[] args) | |
{ | |
int expCount = 10000000; | |
int successCount = 0; | |
Random random = new Random(); | |
for(int i=0; i<expCount; i++) | |
{ | |
int selection = random.nextInt(3); | |
int realValue = random.nextInt(3); | |
if(selection==realValue) //player's chosen the right card and doesn't give a fuck | |
successCount++; | |
} | |
double percentage = ((double)successCount/(double)expCount)*100; | |
System.out.println(percentage + "%"); | |
successCount = 0; | |
for(int i=0; i<expCount; i++) | |
{ | |
int selection = random.nextInt(3); | |
int realValue = random.nextInt(3); | |
if(selection==realValue) {} //player's chosen the right card but now changes it and fails | |
else successCount++; //player's chosen the WRONG card but now changes it for the right one | |
} | |
percentage = ((double)successCount/(double)expCount)*100; | |
System.out.println(percentage + "%"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment