-
-
Save dekosuke/888306 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
print"".join([map(chr,range(65,91)+range(97,123)+range(48,58)+[95])[id(i)%64] for | |
i in range(16)]) |
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
import System.Random | |
alnum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" | |
int2alnum x= (!!) alnum $ (mod (abs x) 64) | |
main = do | |
gen <- newStdGen | |
let ns = randoms gen :: [Int] | |
print $ map int2alnum (take 16 ns) |
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() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment