以下の内容はhttps://blog.kyanny.me/entry/2021/05/29/030216より取得しました。


Generate random password-ish string in Ruby

gist.github.com

Notes

For generating string of random numbers, SecureRandom#random_number can be used. However, it doesn't guarantee returning fixed length of string.

irb(main):011:0> loop { s = SecureRandom.random_number(10**10).to_s; break "#{s} is #{s.size} length of string" if s.size != 10 }
=> "99743850 is 8 length of string"

It might be better to exclude some symbol characters like whitespace, single quote, double quote and backslash because they make output string hard to see.

# symbols without whitespace, single quote, double quote, and backslash
def generate_random_symbols_without_some_chars(length)
  chars = 0.upto(127).map(&:chr).select{|c| c.match?(/[[:print:]]/) } - [' ', "'", '"', '\\'] - (0..9).to_a.map(&:to_s) - ('a'..'z').to_a - ('A'..'Z').to_a
  length.times.map{ chars.shuffle.first }.join
end



以上の内容はhttps://blog.kyanny.me/entry/2021/05/29/030216より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14