Sha256: 366bf35cdf4ba3712a65cf64d239b1538229e127ecff2c6ae1126cc8703298c9

Contents?: true

Size: 346 Bytes

Versions: 5

Compression:

Stored size: 346 Bytes

Contents

module Test
	class Helper
		# 随机字母字符串,默认 6 位长度
		def randomString(length = 6)
			endIndex = length % 26
			('a'..'z').to_a.shuffle[0,endIndex].join
		end

		# 随机数字字符串
		def randomNumString(n)
			result = []
			n.to_i.times do
				result << [0,1,2,3,4,5,6,7,8,9].sample
			end
			result.join
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
authing_ruby-1.1.6 lib/authing_ruby/test/helper.rb
authing_ruby-1.1.5 lib/authing_ruby/test/helper.rb
authing_ruby-1.1.4 lib/authing_ruby/test/helper.rb
authing_ruby-1.1.3 lib/authing_ruby/test/helper.rb
authing_ruby-1.1.2 lib/authing_ruby/test/helper.rb