add a more reliable but slower random function
improve