From b0f3e61d3e2e26d481629c47d6d7ac211e942a58 Mon Sep 17 00:00:00 2001 From: Eric Girard Date: Mon, 6 Feb 2023 16:03:40 +0000 Subject: [PATCH] Initial implementation --- random.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 random.c 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; +}