diff --git a/xtandard.c b/xtandard.c index 844199b..7d3d76e 100644 --- a/xtandard.c +++ b/xtandard.c @@ -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; diff --git a/xtandard.h b/xtandard.h index 9f2c0fa..266c4bb 100644 --- a/xtandard.h +++ b/xtandard.h @@ -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);