array select random item ruby code example
Example: ruby array randomly display
arr = [1, 2, 3, 4]
arr.sample # => 3 pick random number
arr.shuffle # => [3, 1, 4, 2]
arr = [1, 2, 3, 4]
arr.sample # => 3 pick random number
arr.shuffle # => [3, 1, 4, 2]