Adding random choosing to optimisation