class Random
Public Class Methods
rand_str(length)
click to toggle source
随机长度的字符串
# File lib/core_extend/random.rb, line 4 def self.rand_str(length) length.times.inject('') { |acc, i| acc+=(('a'..'z').to_a+('0'..'9').to_a)[(i+Random.rand(1000))%36]; acc } end