Sha256: 6f703d956f05154a07776b8928213c253d1d6d605ee9becbb0be294ab692f9a7
Contents?: true
Size: 465 Bytes
Versions: 16
Compression:
Stored size: 465 Bytes
Contents
# encoding: utf-8 class Array # Returns random item from the array # # @author Botanicus # @since 0.0.2 # @return [Object] Random item from array def rand self[Kernel.rand(length)] end alias_method :random, :rand end class Range # Returns random item from the array # # @author Botanicus # @since 0.0.2 # @return [Object] Random item from range def rand self.min + Kernel.rand(self.max) end alias_method :random, :rand end
Version data entries
16 entries across 16 versions & 4 rubygems