Proton and heavy ion acceleration by stochastic fluctuations in the Earth's magnetotail