Java Random String generateRandomString(Random random, int length)

Here you can find the source of generateRandomString(Random random, int length)

Description

generate Random String

License

Open Source License

Declaration

public static String generateRandomString(Random random, int length) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    public static String generateRandomString(Random random, int length) {
        return random.ints(48, 122).filter(i -> (i < 57 || i > 65) && (i < 90 || i > 97)).mapToObj(i -> (char) i)
                .limit(length).collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
    }/*from www .j a v a  2 s . co  m*/
}

Related

  1. generateRandomString(int n)
  2. generateRandomString(int n)
  3. generateRandomString(int size)
  4. generateRandomString(int stringLength)
  5. generateRandomString(int wordsLength, String separator)
  6. generateRandomString(Random random, int size)
  7. generateRandomString(Random rnd, char[] alphabet, int maxLength)
  8. generateRandomString(String str, int length)
  9. genRandomString()