Skip to content

Instantly share code, notes, and snippets.

@syossan27
Created December 24, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syossan27/f152b2e6d3d30803b5ae132ab1e878da to your computer and use it in GitHub Desktop.
Save syossan27/f152b2e6d3d30803b5ae132ab1e878da to your computer and use it in GitHub Desktop.
codes = Set[]
while codes.size != num
code = (0...6).map { '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'.chars[rand(62)] }.join
next if codes.add?(code).nil?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment