package be.iminds.jfed.gts_highlevel.util;

import java.security.SecureRandom;

/**
 * User: twalcari
 * Date: 10/7/2015
 * Time: 11:05
 */
public class PasswordUtil {

    private static final String PASSWORD_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345789";
    private static final SecureRandom RANDOM = new SecureRandom();

    private PasswordUtil(){}

    public static String generatePassword(int length) {

        StringBuilder result = new StringBuilder();

        for (int i = 0; i < length; i++) {
            result.append(PASSWORD_CHARACTERS.charAt(RANDOM.nextInt(PASSWORD_CHARACTERS.length())));
        }

        return result.toString();


    }

}
