public class DefaultRandomizer extends Object implements Randomizer
Randomizer| Modifier and Type | Method and Description |
|---|---|
static Randomizer |
getInstance() |
boolean |
getRandomBoolean()
Returns a random boolean.
|
byte[] |
getRandomBytes(int n)
Generates a specified number of random bytes.
|
String |
getRandomFilename(String extension)
Returns an unguessable random filename with the specified extension.
|
String |
getRandomGUID()
Generates a random GUID.
|
int |
getRandomInteger(int min,
int max)
Gets the random integer.
|
long |
getRandomLong()
Gets the random long.
|
float |
getRandomReal(float min,
float max)
Gets the random real.
|
String |
getRandomString(int length,
char[] characterSet)
Gets a random string of a desired length and character set.
|
public static Randomizer getInstance()
public String getRandomString(int length, char[] characterSet)
getRandomString in interface Randomizerlength - the length of the stringcharacterSet - the set of characters to include in the created random stringpublic boolean getRandomBoolean()
getRandomBoolean in interface Randomizerpublic int getRandomInteger(int min,
int max)
getRandomInteger in interface Randomizermin - the minimum integer that will be returnedmax - the maximum integer that will be returnedpublic long getRandomLong()
getRandomLong in interface Randomizerpublic float getRandomReal(float min,
float max)
getRandomReal in interface Randomizermin - the minimum real number that will be returnedmax - the maximum real number that will be returnedpublic String getRandomFilename(String extension)
getRandomFilename in interface Randomizerextension - extension to add to the random filenamepublic String getRandomGUID() throws EncryptionException
For more information including algorithms used to create UUIDs, see the Internet-Draft UUIDs and GUIDs or the standards body definition at ISO/IEC 11578:1996.
getRandomGUID in interface RandomizerEncryptionException - if hashing or encryption failspublic byte[] getRandomBytes(int n)
getRandomBytes in interface Randomizern - The requested number of random bytes.n random bytes are returned.Copyright © 2016 The Open Web Application Security Project (OWASP). All rights reserved.