Skip to content

Instantly share code, notes, and snippets.

@barek2k2
Created October 26, 2016 14:18
Show Gist options
  • Save barek2k2/0c8b96d08f1e855aee3fa0417f1ff62d to your computer and use it in GitHub Desktop.
Save barek2k2/0c8b96d08f1e855aee3fa0417f1ff62d to your computer and use it in GitHub Desktop.
o = [('A'..'Z')].map { |i| i.to_a }.flatten
string = (0...2).map { o[rand(o.length)] }.join + rand(100..999).to_s
# this is not 100% accurate to gurantee that the same name wont be assigned twice but the chances are very low
# if we want to make 100% sure of uniqness then we must use the database to keep track
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment