Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Random.h

Committer:
RichardE
Date:
2013-06-17
Revision:
18:70190f956a24
Parent:
4:673eb9735d44

File content as of revision 18:70190f956a24:

/*
 * SOURCE FILE : Random.h
 *
 * Definition of class Random.
 * Generates random numbers a bit like the random function used by Arduino and Maple and so on.
 *
 */

#ifndef RandomDefined

  #define RandomDefined

  #include <stdlib.h>
  
  class Random {

  public :

    /***********************/
    /* GET A RANDOM NUMBER */
    /***********************/
    // Get a random number between min and max.
    // Result may be equal to min but is always less than max.
    static long Get( long min, long max ) {
        return min + ( rand() % ( max - min ) );
    }
    
    /***********************/
    /* GET A RANDOM NUMBER */
    /***********************/
    static long Get( long max ) {
        return Get( 0L, max );
    }
        
  };

#endif

/* END of Random.h */