Friday, January 20, 2017

Minimal Perl code to generate 32 characters alphanumeric random string.

This code generates a random 32 characters string.

use v5.22;
print join '', map {state $c = ['a'..'z', 'A'..'Z', '0'..'9']; $$c[rand @$c]} 0..31;

Output (6 runs):

NUPtwWIRTDOTmoBZ2xgDtceHjvjUloAi
7rKd8024tNZdgCUJJjlrQlBqKh53lpUV
dSPKG8uODbriqmbtEFDvrypbrx22BhuO
A5ozpCeKTCY322otKSlhiAcOV4E8LwZS
DTKcTiUJ7xGFO3kR6Tmh29J5rT88jBoJ
y7Q7VeCY7q83P7c2D2JK9C8svy59efXw

No comments:

Post a Comment