diff --git a/random.c b/random.c new file mode 100644 index 0000000..8deb622 --- /dev/null +++ b/random.c @@ -0,0 +1,17 @@ +#include +#include +int random_int(int max) +{ +return rand() % max; +} +int main(int argc, char *argv[]) +{ +if (argc != 2) { +fprintf(stderr, "Usage: %s \n", argv[0]); +return EXIT_FAILURE; +} +int max = atoi(argv[1]); +int result = random_int(max); +printf("%d\n", result); +return EXIT_SUCCESS; +}