Java examples for java.util:Random String
create Random Char Sequence
//package com.java2s; import java.security.SecureRandom; public class Main { private final static String POSIBLE_SYMBOLS = "qwertzuiopasdfghjklyxcvbnmMNBCXYLKJHGFDSAPOIUZTRWQ1234567890"; public static String createRandomCharSequence(int size) { String randomSymbols = ""; SecureRandom randomizer = new SecureRandom(); for (int i = 0; i < size; i++) { int index = randomizer.nextInt(POSIBLE_SYMBOLS.length()); char nextSymbol = POSIBLE_SYMBOLS.charAt(index); randomSymbols += nextSymbol; }/*from w w w.jav a 2 s. co m*/ return randomSymbols; } }