change sample argorithm