Package de.presti.ree6.utils.others
Class RandomUtils
java.lang.Object
de.presti.ree6.utils.others.RandomUtils
Utility class for random things.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final RandomAn instance of the used Random.static final SecureRandomAn instance of the used SecureRandom.
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringgetRandomBase64String(int length) Create a new Base64 String.static doublenextDouble(double startInclusive, double endInclusive) Generates a random number between the given min and the given max.static floatnextFloat(float startInclusive, float endInclusive) Generates a random number between the given min and the given max.static intnextInt(int startInclusive, int endExclusive) Generates a random number between the given min and the given max.static Stringrandom(int length, char[] chars) Generates a string with the given length and amount of characters.static StringGenerates a string with the given length and amount of characters.static StringrandomNumber(int length) Generates a random number with the given amount of digits.static StringrandomString(int length, boolean specialChars) Generates a string with the given amount of characters.static doubleround(double value, int places) Round a double.
- 
Field Details- 
randomAn instance of the used Random.
- 
secureRandomAn instance of the used SecureRandom.
 
- 
- 
Method Details- 
nextIntpublic static int nextInt(int startInclusive, int endExclusive) Generates a random number between the given min and the given max.- Parameters:
- startInclusive- The minimum number.
- endExclusive- The maximum number.
- Returns:
- A random number between the given min and the given max.
 
- 
nextDoublepublic static double nextDouble(double startInclusive, double endInclusive) Generates a random number between the given min and the given max.- Parameters:
- startInclusive- The minimum number.
- endInclusive- The maximum number.
- Returns:
- A random number between the given min and the given max.
 
- 
nextFloatpublic static float nextFloat(float startInclusive, float endInclusive) Generates a random number between the given min and the given max.- Parameters:
- startInclusive- The minimum number.
- endInclusive- The maximum number.
- Returns:
- A random number between the given min and the given max.
 
- 
randomNumberGenerates a random number with the given amount of digits.- Parameters:
- length- The amount of digits.
- Returns:
- A random number with the given amount of digits.
 
- 
randomStringGenerates a string with the given amount of characters.- Parameters:
- length- The amount of characters.
- specialChars- If special characters should be used.
- Returns:
- A string with the given amount of characters.
 
- 
randomGenerates a string with the given length and amount of characters.- Parameters:
- length- The amount of characters.
- chars- The characters to use.
- Returns:
- A string with the given amount of characters.
 
- 
randomGenerates a string with the given length and amount of characters.- Parameters:
- length- The amount of characters.
- chars- The characters to use.
- Returns:
- A string with the given amount of characters.
 
- 
getRandomBase64StringCreate a new Base64 String.- Parameters:
- length- The length of the String.
- Returns:
- StringA Base64 String.
 
- 
roundpublic static double round(double value, int places) Round a double.- Parameters:
- value- the double to round.
- places- the fixed decimal points.
- Returns:
- the round double.
 
 
-