
public class RandomNumbers {

	public static void main(String[] args) {
		
		//random number between 0 and 1 (not 1)   [0,1)
		System.out.println(Math.random());
		
		//random number between 0 and 10 (not 10) [0, 10)
		System.out.println(Math.random()*10);
		
		//int in [0, 10)
		System.out.println((int)(Math.random()*10));
		
		//flip a coin
		// heads: 0
		// tails: 1
		int flip = (int)(Math.random()*2);
		System.out.print("You flipped ");
		
		if(flip == 0) {
			System.out.println("heads.");
		}
		else {
			System.out.println("tails.");
		}
		
		//roll two 6-sided dice
		int roll1 = (int)(Math.random()*6) + 1;
		int roll2 = (int)(Math.random()*6) + 1;
		
		//print their sum
		System.out.println("The sum is " + (roll1 + roll2));
		
		
		//two integers between -10 and 10 (inclusive)
		int number1 = (int)(Math.random()*21) - 10;
		int number2 = (int)(Math.random()*21) - 10;
		
		
		System.out.println(number1 + ", " + number2);
		
		//print them in order
		if(number1 > number2) {
			//swap the two values
			int temp = number1; //old value of number1
			number1 = number2;
			number2 = temp;
		}
		
		System.out.println(number1 + ", " + number2);
		
		int value = (int)(Math.random()*21) - 10;
		
		//absolute value of value
		// (condition)? true-value : false-value
		value = (value < 0)? -value : value;
		
		
		System.out.println(value);
		

		//from quiz
		int x= 3;
		System.out.println(x++ + x);
		System.out.println(x);
		
		x = 3;
		
	
		System.out.println(x + x++);
		System.out.println(x);
		
	}

}
