Sha256: 3dbf8dfc00a576ee5462a2a6ffd13cfc4aa68d11fd8996a4fe39b5ee5c10a53e

Contents?: true

Size: 804 Bytes

Versions: 9

Compression:

Stored size: 804 Bytes

Contents

class Range
  # pull a random element out of this range
	def to_random_i
		self.to_a.sort_by { rand }.first
	end
	
	# create a string of random letters whose length is one of the values in your range
	# (3..4).random_letters # => returns a string or 3 or 4 random letters
	def random_letters
		self.to_random_i.random_letters
	end
	
	# create a string of random numbers whose length is one of the values in your range
	# (3..4).random_numbers # => returns a string or 3 or 4 random numbers
	def random_numbers opts = {}
		self.to_random_i.random_numbers opts
	end
	
	# create a string of random characters whose length is one of the values in your range
	# (3..4).random_characters # => returns a string or 3 or 4 random characters
	def random_characters
		self.to_random_i.random_characters
	end
	
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
brightbox-rujitsu-0.1.8 lib/rujitsu/range.rb
brightbox-rujitsu-0.1.9 lib/rujitsu/range.rb
brightbox-rujitsu-0.2.5 lib/rujitsu/range.rb
brightbox-rujitsu-0.2 lib/rujitsu/range.rb
rahoulb-rujitsu-0.1.7 lib/rujitsu/range.rb
rahoulb-rujitsu-0.1.8 lib/rujitsu/range.rb
rujitsu-0.3.1 lib/rujitsu/range.rb
rujitsu-0.3 lib/rujitsu/range.rb
rujitsu-0.2.5 lib/rujitsu/range.rb