Issue #4: Randomize the algorithm