Now you generate a real maze. The recursive backtracker is a randomized depth-first walk that carves as it goes, and seeded with your generator it produces one specific, reproducible maze.
Generate a maze with a randomized depth-first backtracker driven by the seeded generator.
The recursive backtracker is the simplest good maze generator. It is a depth-first walk that carves as it explores: from the current room, look at the four directions in a shuffled order, and for the first neighbor that has not been visited, carve a passage into it and recurse from there. When a room has no unvisited neighbors the recursion unwinds, backtracking to the last room that still has options, until every room has been visited exactly once.
Because the walk visits each room once and carves exactly one passage as it enters each new room, it threads a single long, winding corridor through the whole maze. The only randomness is the shuffle at each cell, so the seed fully determines the result: seed 1 on a 2 by 2 maze always carves the same three passages into the same picture. Every choice traces back to the reproducible stream you built, which is why the render is a fixed value you can assert. Next you prove this maze has a special structural property.
// depth-first: mark visited, try neighbors in a shuffled direction order,// carve into any unvisited in-bounds neighbor and recurse.func (m *Maze) carve(c Coord, visited map[Coord]bool, r *RNG) {visited[c] = trueorder := []int{0, 1, 2, 3}; r.Shuffle(order) // shuffle dir indicesfor _, di := range order {d := dir4[di] // dir4 = N,E,S,Wn := Coord{c.X + d.X, c.Y + d.Y}if m.inBounds(n) && !visited[n] { m.Carve(c, n); m.carve(n, visited, r) }}}