Alternative (more robust) way to generate bootstrap samples

Note: not tested yet.