Randomize the elements of an array:
random_array = my_array.sort_by{rand}
Randomize a string (jumble a given word):
jumbled_word = word.split("").sort_by{rand}.join
Tech Tidbits - Ruby, Ruby On Rails, Merb, .Net, Javascript, jQuery, Ajax, CSS...and other random bits and pieces.
No comments:
Post a Comment