Register
|
Login
Home
About
Demo
Blog
Forums
Download
Plugins
Install
Translation
Contact
Forums
»
Ruby on Rails
» Ruby : Shuffle your Arrays
Search:
techslam
2010-06-27 16:05:27 UTC
From Ruby 1.8.7 on, elements of an Array can be ordered at random using the shuffle method:
a = [ 1, 2, 3 ] #=> [1, 2, 3]
a.shuffle #=> [2, 3, 1]