New to Ruby - how do I shuffle a string?

Viewed 11240

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
6 Answers
Related