Strange issues in rand() and endl fixed.