added an extra condition to check if the file is empty or not in randomlineselection function