-
Notifications
You must be signed in to change notification settings - Fork 4
RandomGenUtils
Aram edited this page Jan 9, 2025
·
3 revisions
The RandomGenUtils
class in the software.bluelib.utils.math
package provides methods to generate random values of various types. These methods include generating random integers, doubles, booleans, and alphanumeric strings, allowing flexible specification of range or length for the generated values.
-
generateRandomInt(int, int)
Generates a random integer within a specified range.int randomInt = RandomGenUtils.generateRandomInt(1, 10);
-
generateRandomDouble(double, double)
Generates a random double within a specified range.double randomDouble = RandomGenUtils.generateRandomDouble(0.5, 2.0);
-
generateRandomBoolean()
Generates a random boolean value.boolean randomBool = RandomGenUtils.generateRandomBoolean();
-
generateRandomString(int)
Generates a random alphanumeric string of a specified length.String randomString = RandomGenUtils.generateRandomString(8);
-
generateRandomStringWithPrefix(String, int)
Generates a random alphanumeric string with a specified prefix and length.String randomStringWithPrefix = RandomGenUtils.generateRandomStringWithPrefix("ID-", 10);
- Error Handling: If an invalid parameter is provided (e.g., negative lengths or minimum values greater than maximum values), the method throws an appropriate exception and logs an error message.
- Utility Design: This class cannot be instantiated, as it contains a private constructor and only static methods.
Variant Loader
Logging
Interfaces
Utility Classes
- Conversion
- Math
- Minecraft