S
slix
puts "Enter a sentence: "
puts gets.split.sort_by { rand }.join(" ")
takes a sentence and scrambles the words. how is this implemented? i
tried myself first with a for or while loop and tried if word is not
in new_sentence then new_sentence += word etc.
but that could go on for a long time and would be very slow for a
large text.
puts gets.split.sort_by { rand }.join(" ")
takes a sentence and scrambles the words. how is this implemented? i
tried myself first with a for or while loop and tried if word is not
in new_sentence then new_sentence += word etc.
but that could go on for a long time and would be very slow for a
large text.