modify: show NaN if result contains NaN
modify: clock() is invalid as seed of srand()