upgrade the resample algorithm in ParticleFilter

Replace the super slow O(n^2) algorithm with a new one which requires only a quick-sort and a linear scan.