Magnetization reversal in nanomagnets is often stochastic at practical temperatures, and this is particularly problematic for information storage, where deterministic switching is sought. Using a combination of experiments, analytical modeling, and numerical simulations, the authors study the physical origin of the stochasticity of domain-wall-based magnetization reversal. Proper choice of nanomagnet geometry renders domain-wall motion largely immune to fluctuations, for almost perfect reproducibility. Combining this with other tricks that make domain-wall nucleation repeatable would minimize write-error rates in memory cells, and thereby allow their further optimization.