choose / random

Hello everyone! Can you help me? I would like to choose / draw random elements of a array then display them, how do to do

if you want to keep the array
[1,2,3,4,5,6].shuffle.first

if you want to consume the array
a = [1,2,3,4,5,6].shuffle
a.pop

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs