To generate a random array in Ruby, you can use the shuffle method of an array.
main.rb
# Generate a random array of numbers from 1 to 10arr = (1..10).to_a.shuffle
puts arr.inspect
# Generate a random array of lettersarr = ('A'..'Z').to_a.shuffle
puts arr.inspect
179 chars
8 lines
The shuffle method randomly shuffles the elements in the array, effectively creating a new random order.