Cosmological information from weak lensing surveys is maximized by sorting source galaxies into tomographic redshift subsamples. Any uncertainties on these redshift distributions must be correctly propagated into the cosmological results. We present hyperrank, a new method for marginalizing over redshift distribution uncertainties, using discrete samples from the space of all possible redshift distributions, improving over simple parametrized models. In hyperrank, the set of proposed redshift distributions is ranked according to a small (between one and four) number of summary values, which are then sampled, along with other nuisance parameters and cosmological parameters in the Monte Carlo chain used for inference. This approach can be regarded as a general method for marginalizing over discrete realizations of data vector variation with nuisance parameters, which can consequently be sampled separately from the main parameters of interest, allowing for increased computational efficiency. We focus on the case of weak lensing cosmic shear analyses and demonstrate our method using simulations made for the Dark Energy Survey (DES). We show that the method can correctly and efficiently marginalize over a wide range of models for the redshift distribution uncertainty. Finally, we compare hyperrank to the common mean-shifting method of marginalizing over redshift uncertainty, validating that this simpler model is sufficient for use in the DES Year 3 cosmology results presented in companion papers