diff --git a/src/rand.c b/src/rand.c index 8deb622..e245c78 100644 --- a/src/rand.c +++ b/src/rand.c @@ -1,17 +1,23 @@ #include #include +#include + int random_int(int max) { -return rand() % 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; + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return EXIT_FAILURE; + } + int max = atoi(argv[1]); + + srand(time(NULL)); + int result = random_int(max); + printf("%d\n", result); + + return EXIT_SUCCESS; }