def pool_length = in_length?:10;
def lowerCase = ['a'..'z'].flatten() - [ 'O', '0', 'l', '1', 'I' ]

def pool = lowerCase

Random rand = new Random(System.currentTimeMillis());
def passChars = (0..pool_length - 1).collect { pool[rand.nextInt(pool.size())] };

passChars[0] = lowerCase[rand.nextInt(lowerCase.size())]
passChars[pool_length - 2] = lowerCase[rand.nextInt(lowerCase.size())]

def low_string = passChars.join('');

low_string