ruby array randomly display
arr = [1, 2, 3, 4]
arr.sample # => 3 pick random number
arr.shuffle # => [3, 1, 4, 2]
Are there any code examples left?
New code examples in category Ruby
arr = [1, 2, 3, 4]
arr.sample # => 3 pick random number
arr.shuffle # => [3, 1, 4, 2]