Generating sparse connected Erdős–Rényi random graphs
Brenday McKay suggests an algorithm on mathoverflow. He considers a fixed number of edges, but you can also sample from $G(n,p)$ according to his method. First, calculate $c_{n,m}$ for all $m$. Then sample $m$ in proportion to $p^m (1-p)^{\binom{n}{2}-m} c_{n,m}$. Then use his algorithm.
Gray, Mitchell, and Roughan, Generating connected random graphs, suggest an MCMC algorithm, and analyze it empirically.
Both of these algorithms are for sampling $G(n,p)$ random graphs conditioned on the result being connected. There are also many heuristics for sampling other distributions of random connected graphs in the sparse regime, where usually the focus is on generating some &quot;random-looking&quot; distribution rather than a specific one. For example, you can generate a $G(N,p)$ random graph and pick a connected component, or you can add a random spanning tree to a $G(n,p')$ random graph.