I am new with grails and on my web application i want to generate a random token with 15 characters length along with username. And tokens must be unique.
All characters from a-z and 0-9 can be use, but no special characters. I have tried to generate random token with
def generator = {String alphabet, int n -> new Random().with { (1..n).collec alphabet[ nextInt( alphabet.length() ) ] }.join() }} generator( (('A'..'Z')+('0'..'9')).join(), 9 )
but how can i append username infront of token like "JayKay586464ASDHH445"
UUID.randomUUID()
– Feinberg