Java Random Int randomAlphanumericString(int length)

Here you can find the source of randomAlphanumericString(int length)

Description

random Alphanumeric String

License

Open Source License

Declaration

public static String randomAlphanumericString(int length) 

Method Source Code

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

public class Main {
    public static String randomAlphanumericString(int length) {
        String set = "abcdefghijklmnopqrstuwxyz0123456789";
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            builder.append(set.charAt(randomNumber(0, set.length())));
        }/*from w w  w. ja va2s .  c o  m*/
        return builder.toString();
    }

    public static int randomNumber(int a, int b) {
        return a + (int) (Math.random() * (b - a));
    }
}

Related

  1. random(int... array)
  2. random_range(int x1, int x2)
  3. randomActorId(int max)
  4. randomAlphaNum(int length)
  5. randomAlphanumeric(int count)
  6. randomAlphaString(int length)
  7. randomArray(int len)
  8. randomArray(int min, int max, int n)
  9. randomBases(int n)