Skip to content

Instantly share code, notes, and snippets.

@dawesi
Last active August 29, 2015 14:13
Show Gist options
  • Save dawesi/83b78c5a7975d88a35bd to your computer and use it in GitHub Desktop.
Save dawesi/83b78c5a7975d88a35bd to your computer and use it in GitHub Desktop.
public string function createRandomString()
{
var rules = { minLength = 8, maxLength = 12 };
var length = randRange(rules.minLength,rules.maxLength,'SHA1PRNG');
var passwd = ['2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','J','K','M','N','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','##','@','$','&','*','+'];
createObject('java','java.util.Collections').shuffle(passwd);
return arrayToList(arraySlice(passwd,1,length),'');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment