Question : ruby array randomly display
Answered by : lior
arr = [1, 2, 3, 4]
arr.sample # => 3 pick random number
arr.shuffle # => [3, 1, 4, 2]
Source : | Last Update : Mon, 16 Nov 20
Question : ruby generate array of numbers
Answered by : nguyen-quang-huy
(1..10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Source : | Last Update : Mon, 06 Jun 22