lib/garcon/core_ext/random.rb
# Similar to #at_rand!, but given a number will return an array of exclusive
# elements.
Similar to #at_rand!, but given a number will return an array of exclusive
elements.
Similar to #at_rand! but given a number will return an array of exclusive elements .
def pick!(n = nil)
      if n
        if n > self.size
          r = self.dup
          self.replace([])
          r
        else
          r = []
          n.times { r << delete_at(SecureRandom.random_number(size)) }
          r
        end
      else
        delete_at(SecureRandom.random_number(size))
      end
    end
def pick! ( n = nil ) if n if n > self . size r = self . dup self . replace ( [ ] ) r else r = [ ] n . times { r << delete_at ( SecureRandom . random_number ( size ) ) } r end else delete_at ( SecureRandom . random_number ( size ) ) end end
Similar to #at_rand!, but given a number will return an array of exclusive
elements.
Similar to #at_rand! but given a number will return an array of exclusive elements .
n
<not_specific>