Groovy web console

subscribe to the feed Subscribe
to this
site

pw gen

Published 3 months ago by Anonymous
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def length = 16
def characterSet = null
  if (characterSet == null) {
    characterSet = ['a'..'z', 'A'..'Z', '0'..'9', '_'].flatten()
  }
  Random rand = new Random(System.currentTimeMillis())

  def passChars = (0..length).collect { characterSet[rand.nextInt(characterSet.size())] }
println passChars.join()