/*
 * Coin Flipper
 * This program makes use of the random function
 * and the if statement to simulate a coin toss.
 * Run the program multiple times to test for randomness.
 */

#include <iostream>  
#include <stdlib.h>  // stdlib.h makes srand and rand available 
#include <time.h>    // time.h makes time available
using namespace std;

int main() { 
  //srand stands for seed random
  //it seeds your random function with a starting value
  //time gets the current calendar time as a time_t object and seeds the srand function

  srand(time(NULL));
  
  //Modulo ensures that values procuced are either 0 or 1
  if (rand()%2 == 1) {
    cout << "HEADS" << endl;
  } else {
    cout << "TAILS" << endl;
  } 

  return 0;
}
