Loop logic added. srand() is in correct place.