use rand instead of drand48