![](/media/cache/profiles/fa1fc368935a59b748bec5e15aca97ea.jpg.50x50_q85.png)
This code contains the game Starship designed for the STM32F429i-DISC1 board. It requires a keyboard to play.
Dependencies: Starship LCD_DISCO_F429ZI USBHost mbed
RandomVar.c
- Committer:
- Oshyrath
- Date:
- 2017-11-17
- Revision:
- 1:527a11035e0b
File content as of revision 1:527a11035e0b:
#include "RandomVar.h" int8_t probabilityOfSuccess(float prob) { int randInt = rand(); float maxInt = RAND_MAX*prob; return randInt<maxInt ? 1 : 0; } int randomInt(int min,int max) { int range = max - min + 1; int result = (int)((rand()/((float)RAND_MAX))*range) + min; return result==max+1 ? max : result; }