aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
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);