鳩舎

レースしない

Entries from 2012-01-20 to 1 day

動的 UTF-8 文字列 生成 ランダム

ランダムにUTF-8の文字列を生成しようとしてつまったので適当な解決策 codes = (0x00 ... 0x1ffff).to_a chars = [] (rand(10) + 10).times do chars << codes[rand(codes.length)] end chars.pack('U*') これで10文字から20文字のUTF-8の文字列がランダムに…