refactoring the random walk incremental test to make the code reusable