Array#sample - the simplest way to get a random element(s) from array
Here’s a quick tip on how to get a random element from array using Array#sample - http://blog.ugisozols.com/2012/08/28/array-sample.
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Here’s a quick tip on how to get a random element from array using Array#sample - http://blog.ugisozols.com/2012/08/28/array-sample.
Post a comment