resampleParticles function

Resample in place to avoid expensive copying of data structures, using a permutation of the ancestry vector.