Skip to content

Instantly share code, notes, and snippets.

@boycaught
Created May 28, 2012 23:01
Show Gist options
  • Save boycaught/2821561 to your computer and use it in GitHub Desktop.
Save boycaught/2821561 to your computer and use it in GitHub Desktop.
Generate random alphanumirc string of any length
<cfscript>
function generateRandomAlphaNumString(size) {
var _t = [];
for (i=1; i<=arguments.size; i++) {
if (randrange(1,2) eq 2) {_t[i]=chr(randrange(65,90));}
else if (randrange(1,2) eq 2) {_t[i]=chr(randrange(97,122));}
else {_t[i]=chr(randrange(48,57));}
}
return arraytolist(_t,'');
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment