gen_random_reddit_id 508 B

123456789101112131415161718192021
  1. #!/usr/bin/env ruby
  2. words = File.readlines('word_seed').map(&:chomp)
  3. # Count the number of uniqs in the p2p file
  4. 15792.times do
  5. username_len = 3+Random.rand(2)
  6. uname = []
  7. if username_len > 3
  8. (username_len-1).times { uname << words[Random.rand(words.length)] }
  9. uname << (1971+Random.rand(31)).to_s
  10. else
  11. (username_len-1).times { uname << words[Random.rand(words.length)] }
  12. end
  13. if Random.rand(2) > 0
  14. puts uname.join('_')
  15. else
  16. puts uname.map{|x| x.capitalize}.join
  17. end
  18. end