Want to shuffle a string. This is my code: what is wrong about it? Thanks.
>> def string_shuffle(s)
>> s.split('').shuffle(s.length()).join
>> return s
>> end
If understand you correctly, you want this:
def string_shuffle(s)
s.split("").shuffle.join
end
string_shuffle("The Ruby language")
=> "ea gu bgTayehRlnu"