change rand function to use rand() instead fixed pseudo-randome function lcgrand()