From fb61acb97b7564ed9b85049a200c335f393ef05f Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Thu, 26 Mar 2026 23:23:30 +0300 Subject: Use rand() as seed instead of current time --- main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 79cd630..09c589e 100644 --- a/main.c +++ b/main.c @@ -60,6 +60,8 @@ int main(int argc, char **argv) { char is_maze = 0; char anim = 0; int dirs = 8; + + srand(time(NULL)); /* Handle args. * Currently supported: @@ -96,7 +98,7 @@ int main(int argc, char **argv) { mwidth = atoi(argv[2]); mheight = atoi(argv[3]); } - map = rbt_maze_map(mwidth, mheight, (unsigned int) time(NULL)); + map = rbt_maze_map(mwidth, mheight, rand()); start_pos.x = 0; start_pos.y = 0; height = mheight * 2 - 1; @@ -133,7 +135,7 @@ int main(int argc, char **argv) { case 'n': if (is_maze) { map_free(map, height); - map = rbt_maze_map(mwidth, mheight, (unsigned int) time(NULL)); + map = rbt_maze_map(mwidth, mheight, rand()); path_free(path, height); if (dirs == 4) { path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited, anim); -- cgit v1.2.3