get_samples function

Generate a sample of values from a vector and collapse them.