Mercurial > ec-dotfiles
view bin/randstr @ 634:ced2ee9efd9f
Update various syntaxes to the ones in vim repo
author | nanaya <me@nanaya.pro> |
---|---|
date | Tue, 17 Dec 2019 20:21:23 +0900 |
parents | ecff9d2c0500 |
children |
line wrap: on
line source
#!/usr/bin/env ruby require "securerandom" def random_base62(length) group = ["A".."Z", "a".."z", "0".."9"].map(&:to_a).flatten length.times.map do |x| group[SecureRandom.random_number(group.length)] end.join end length = ARGV[0].to_i length = 12 if length <= 0 puts random_base62(length)