Sha256: b47d68c5d972b88aaf13ac3c885ec9073c77bf9ec1a60ad8b0963eca81e49c82

Contents?: true

Size: 284 Bytes

Versions: 6

Compression:

Stored size: 284 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 = 6)
			srand.to_s.chars.last(n).join
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
authing_ruby-1.1.1 lib/authing_ruby/test/helper.rb
authing_ruby-1.1.0 lib/authing_ruby/test/helper.rb
authing_ruby-1.0.9 lib/authing_ruby/test/helper.rb
authing_ruby-1.0.8 lib/authing_ruby/test/helper.rb
authing_ruby-1.0.7 lib/authing_ruby/test/helper.rb
authing_ruby-1.0.6 lib/authing_ruby/test/helper.rb