Sha256: 52edc8b65a44538c3d15593580ec855ef6105238f9d991eac29cf73e5ca2e654

Contents?: true

Size: 190 Bytes

Versions: 6

Compression:

Stored size: 190 Bytes

Contents

class Random

  #随机长度的字符串
  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
core_extend-0.2.1 lib/core_extend/random.rb
core_extend-0.2.0 lib/core_extend/random.rb
core_extend-0.1.9 lib/core_extend/random.rb
core_extend-0.1.8 lib/core_extend/random.rb
core_extend-0.1.7 lib/core_extend/random.rb
core_extend-0.1.5 lib/core_extend/random.rb