random contraction algothrim