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
Diff: Random.h
- Revision:
- 4:673eb9735d44
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Random.h Sat Jun 08 11:24:05 2013 +0000 @@ -0,0 +1,40 @@ +/* + * 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 */ +