  Let $L/K$ be a quadratic extension of global fields. We study Cohen-Lenstra
heuristics for the $\ell$-part of the relative class group $G_{L/K} :=
\textrm{Cl}(L/K)$ when $K$ contains $\ell^n$th roots of unity. While the
moments of a conjectural distribution in this case had previously been
described, no method to calculate the distribution given the moments was known.
We resolve this issue by introducing new invariants associated to the class
group, $\psi_{L/K}$ and $\omega_{L/K},$ and study the distribution of
$(G_{L/K}, \psi_{L/K}, \omega_{L/K})$ using a linear random matrix model. Using
this linear model, we calculate the distribution (including our new invariants)
in the function field case, and then make local adjustments at the primes lying
over $\ell$ and $\infty$ to make a conjecture in the number field case, which
agrees with some numerical experiments.
