Added random integer function...

This commit is contained in:
Ognjen Milan Robovic 2024-06-16 11:57:58 -04:00
parent f256842af0
commit 1887bae82a
2 changed files with 6 additions and 0 deletions

View File

@ -105,6 +105,10 @@ void fatal_failure (int condition, char * message) {
}
}
int random (int minimum, int maximum) {
return (rand () % (maximum - minimum + 1) + minimum);
}
void limit (int * value, int minimum, int maximum) {
if (value == null) {
return;

View File

@ -81,6 +81,8 @@ extern void echo_byte (int byte);
extern void fatal_failure (int condition, char * message);
extern int random (int minimum, int maximum);
extern void limit (int * value, int minimum, int maximum);
extern void * allocate (int size);