replacing rand() with random to avoid rand() issues