Answers for "generating random string number with some constant prefix in java"

3

generate random string in java

import java.util.Random;

public class Generator {
	public static String generateRandomPassword(int len) {
		String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk"
          +"lmnopqrstuvwxyz!@#$%&";
		Random rnd = new Random();
		StringBuilder sb = new StringBuilder(len);
		for (int i = 0; i < len; i++)
			sb.append(chars.charAt(rnd.nextInt(chars.length())));
		return sb.toString();
	}
}
Posted by: Guest on July-16-2020
1

generate 5 digit random string in java

RandomStringUtils.randomAlphanumeric(17).toUpperCase()
Posted by: Guest on September-01-2020

Code answers related to "generating random string number with some constant prefix in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language