Add basic ability to randomly sample structures
Fix issue if the sample number is larger than the population size