Random spanning tree of a rectangular grid
Wolfram Language (Mathematica), 146 bytes

Block[{c,g=GridGraph@{##}},Graph[Range[1##],Join@@Reap[Do[c@n/._c:&gt;#0[Sow[#&lt;-&gt;n];n],{n,RandomSample@AdjacencyList[g,c@#=#]}]&amp;@1][[2]],Options@g]]&amp;


Try it online!

Based on my answer to the question Maze Generation.

Returns a Graph object.

For example, w = 20, h = 20 gives: