A matrix model for random nilpotent groups