We study the joint distribution of random abelian and non-abelian groups. In the abelian case, we prove several universality results for the joint distribution of the multiple cokernels for random p-adic matrices. In the non-abelian case, we compute the joint distribution of random groups given by the quotients of the free profinite group by random relations. In both cases, we generalize the known results on the distribution of the cokernels of random p-adic matrices and random groups. Our proofs are based on the observation that mixed moments determine the joint distribution of random groups, which extends the works of Wood for abelian groups and Sawin for non-abelian groups.