jodd.util
Class RandomStringUtil

java.lang.Object
  extended by jodd.util.RandomStringUtil

public class RandomStringUtil
extends java.lang.Object

Generates random strings.


Field Summary
protected static char[] ALPHA_NUMERIC_RANGE
           
protected static char[] ALPHA_RANGE
           
protected static java.util.Random rnd
           
 
Constructor Summary
RandomStringUtil()
           
 
Method Summary
static java.lang.String random(int count, char[] chars)
          Creates random string whose length is the number of characters specified.
static java.lang.String random(int count, char start, char end)
          Creates random string whose length is the number of characters specified.
static java.lang.String random(int count, java.lang.String chars)
          Creates random string whose length is the number of characters specified.
static java.lang.String randomAlpha(int count)
          Creates random string of characters.
static java.lang.String randomAlphaNumeric(int count)
          Creates random string of characters and digits.
static java.lang.String randomAscii(int count)
          Creates random string whose length is the number of characters specified.
static java.lang.String randomNumeric(int count)
          Creates random string that consist only of numbers.
static java.lang.String randomRanges(int count, char... ranges)
          Creates random string whose length is the number of characters specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rnd

protected static final java.util.Random rnd

ALPHA_RANGE

protected static final char[] ALPHA_RANGE

ALPHA_NUMERIC_RANGE

protected static final char[] ALPHA_NUMERIC_RANGE
Constructor Detail

RandomStringUtil

public RandomStringUtil()
Method Detail

random

public static java.lang.String random(int count,
                                      char[] chars)
Creates random string whose length is the number of characters specified. Characters are chosen from the set of characters specified.


random

public static java.lang.String random(int count,
                                      java.lang.String chars)
Creates random string whose length is the number of characters specified. Characters are chosen from the set of characters specified.


random

public static java.lang.String random(int count,
                                      char start,
                                      char end)
Creates random string whose length is the number of characters specified. Characters are chosen from the provided range.


randomAscii

public static java.lang.String randomAscii(int count)
Creates random string whose length is the number of characters specified. Characters are chosen from the set of characters whose ASCII value is between 32 and 126 (inclusive).


randomNumeric

public static java.lang.String randomNumeric(int count)
Creates random string that consist only of numbers.


randomRanges

public static java.lang.String randomRanges(int count,
                                            char... ranges)
Creates random string whose length is the number of characters specified. Characters are chosen from the multiple sets defined by range pairs. All ranges must be in acceding order.


randomAlpha

public static java.lang.String randomAlpha(int count)
Creates random string of characters.


randomAlphaNumeric

public static java.lang.String randomAlphaNumeric(int count)
Creates random string of characters and digits.



Copyright © 2003-2012 Jodd Team