Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld{
- public static void main(String []args){
- int i = 0;
- int total = 0;
- for (i = 0; i < 1000000; i++) {
- int current = (int)Math.ceil(Math.random()*2.0)*100; //Handed envelope
- int swap = 200;
- if (swap == current)
- swap = 100;
- total += swap;
- }
- System.out.println(total + " money earned in " + i + " trials for an average earning of " + (double)total/(double)i);
- }
- }
Add Comment
Please, Sign In to add comment