modify rand function