rails select arbitrary n element from array
# Given array
original_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# Specify the number of elements to select
n = 3
# Use the `sample` method to randomly select n elements from the array
selected_elements = original_array.sample(n)
# Display the selected elements
puts "Selected elements: #{selected_elements}"