updates algorithm for randomness