I am not sure how PHP became the de facto language for all tasks, but here is alternative solution using Ruby.
Code:
data=IO.readlines('urls.txt')
new_data=data.sort_by {rand}
output=File.open('output.txt','w')
new_data.each do |line|
output.puts line
end
output.close