Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails select arbitrary n element from array

array = [1, 2, 3, 4, 5, 6]

array.shuffle.first(3) # => [5, 2, 4]
 
PREVIOUS NEXT
Tagged: #rails #select #arbitrary #element #array
ADD COMMENT
Topic
Name
8+2 =