diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-26 23:23:30 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-26 23:23:30 +0300 |
| commit | fb61acb97b7564ed9b85049a200c335f393ef05f (patch) | |
| tree | f873fb24284a6b8abfa517b09b0da5b1d613c5ae /main.c | |
| parent | a3b039308419953225fe6ac34b07bd07ce78bbc5 (diff) | |
| download | astar-fb61acb97b7564ed9b85049a200c335f393ef05f.tar.xz | |
Use rand() as seed instead of current time
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |
