| ... | ... |
@@ -10,7 +10,7 @@ Features: |
| 10 | 10 |
- Hunt And Kill |
| 11 | 11 |
- Handles mazes of any size |
| 12 | 12 |
- Random with seed (time in seconds since the epoch by default) |
| 13 |
- - Fairly fast (10000*10000 cells in ~900ms) |
|
| 13 |
+ - Fairly fast (10000*10000 cells in ~1200ms) |
|
| 14 | 14 |
|
| 15 | 15 |
[`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze |
| 16 | 16 |
|
| ... | ... |
@@ -19,7 +19,7 @@ Features: |
| 19 | 19 |
``` |
| 20 | 20 |
$ make |
| 21 | 21 |
$ ./maze dummy |
| 22 |
-885ms |
|
| 22 |
+1193ms |
|
| 23 | 23 |
$ ./maze |
| 24 | 24 |
██ ████████████████████████████████████████████████████████████████████████████ |
| 25 | 25 |
██ ██ ██ ██ ██ ██ ████ |
| ... | ... |
@@ -79,7 +79,7 @@ Maze hunt_and_kill(int w, int h, unsigned seed, C callback = [](Maze &){})
|
| 79 | 79 |
// If we have neighbors, carve path to random one. |
| 80 | 80 |
if (n != 0) |
| 81 | 81 |
{
|
| 82 |
- n = (int)rand() % n; |
|
| 82 |
+ n = std::uniform_int_distribution<>(0, n-1)(rand); |
|
| 83 | 83 |
FOR_NEIGHBOR( |
| 84 | 84 |
if (maze(cx+nx, cy+ny) == Maze::WALL && n-- == 0) |
| 85 | 85 |
{
|