Created
February 12, 2011 09:40
-
-
Save fumokmm/823646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array = [] | |
def tmp = "" | |
array = ('0'..'9') + ('a'..'z') + ('A'..'Z') + '_' | |
(1..16).each { | |
tmp += array[Math.floor(Math.random() * array.size()) as int] | |
} | |
println tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [] | |
tmp = "" | |
array = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a + '_'.to_a | |
(1..16).each { | |
tmp += array[rand(array.size())] | |
} | |
print tmp + "\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array = (0..9) + ('a'..'z') + ('A'..'Z') + '_' | |
def getRandomChar = { | |
array.with { | |
Collections.shuffle(it) | |
head() | |
} | |
} | |
println( | |
(1..16).collect{ getRandomChar() }.join() | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16.times{print(('0'..'z').grep(~/[0-9a-zA-Z_]/)[(int)Math.random()*63])} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
16.times{print(('0'..'z').grep(~/\w/)[(int)Math.random()*63])}