Updated method shuffle and sample