Revert "Revert "change random funcion""

This reverts commit 127e84e08afc5bd17e04571f9217323dbffe60ea.