Skip to content

Instantly share code, notes, and snippets.

@augustl
Created September 8, 2008 01:16
Show Gist options
  • Save augustl/9352 to your computer and use it in GitHub Desktop.
Save augustl/9352 to your computer and use it in GitHub Desktop.
class Array
def rand
self[Kernel.rand(length)]
end
end
characters = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9)
Array.new(4).inject("") {|string, ary| string << characters.rand }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment