-
-
Save bluepapa32/888323 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
def array = (0..9)+('a'..'z')+('A'..'Z')+'_' | |
println new Random().with { (1..16).collect { array[nextInt(array.size())] }.join() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment