first pass at implementing sample(n)