how to create a random string in java

ww‮ruttual.w‬i.com
how to create a random string in java
/**
 * @author lautturi.com 
 * Java example: creating a random string with latin alphabetic characters (a-z, A-Z) and the digits 0-9.
 */

import java.util.*;

import org.apache.commons.lang3.RandomStringUtils;

public class Lautturi {

	public static void main(String[] args) {

		int count = 10; // length of the random string 
		
		String randomStr = RandomStringUtils.randomAlphanumeric(count).toUpperCase();
		System.out.println(randomStr);
		
	}
}

output:

KEAR4WLV4B
Created Time:2017-09-23 22:36:56  Author:lautturi