  We propose a modification to the Cohen--Lenstra prediction for the
distribution of class groups of number fields, which should also apply when the
base field contains non-trivial roots of unity. The underlying heuristic
derives from the distribution of 1-eigenspaces in certain generalized
symplectic groups over finite rings. The motivation for that heuristic comes
from the function field case. We also give explicit formulas for the new
predictions in several important cases. These are in close accordance with
known data.
