processapk will pick a random sample based on samplesize parameter.