Class RandomKit
java.lang.Object
com.iohao.net.common.kit.RandomKit
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintrandom(int end) Gets a random number within the specified range (0 ~ end)intrandom(int start, int end) Gets a random number within the specified rangelongrandom(long end) Gets a random number within the specified range (0 ~ end)longrandom(long start, long end) Gets a random number within the specified rangebooleanRandomly generates a boolean valuedoubleintrandomEle(int[] array) <T> TrandomEle(@NonNull T[] array) <T> TintrandomInt(int limit) Gets a random number within the specified range [0, limit)intrandomInt(int min, int max) Gets a random number within the specified rangelongrandomLong(long limit) Gets a random number within the specified range [0, limit)longrandomLong(long min, long max) Gets a random number within the specified range
-
Constructor Details
-
RandomKit
public RandomKit()
-
-
Method Details
-
randomInt
public int randomInt(int limit) Gets a random number within the specified range [0, limit)- Parameters:
limit- The limit of the random number range, exclusive.- Returns:
- The random number.
-
randomInt
public int randomInt(int min, int max) Gets a random number within the specified range- Parameters:
min- Minimum number (inclusive)max- Maximum number (exclusive)- Returns:
- The random number
-
randomLong
public long randomLong(long limit) Gets a random number within the specified range [0, limit)- Parameters:
limit- The limit of the random number range, exclusive.- Returns:
- The random number
- Since:
- 21.23
-
randomLong
public long randomLong(long min, long max) Gets a random number within the specified range- Parameters:
min- Minimum number (inclusive)max- Maximum number (exclusive)- Returns:
- The random number
- Since:
- 21.23
-
random
public int random(int start, int end) Gets a random number within the specified range- Parameters:
start- Starting value (inclusive)end- Ending value (inclusive)- Returns:
- The random number
-
random
public int random(int end) Gets a random number within the specified range (0 ~ end)- Parameters:
end- Ending value (inclusive)- Returns:
- The random number
-
random
public long random(long start, long end) Gets a random number within the specified range- Parameters:
start- Starting value (inclusive)end- Ending value (inclusive)- Returns:
- The random number
- Since:
- 21.23
-
random
public long random(long end) Gets a random number within the specified range (0 ~ end)- Parameters:
end- Ending value (inclusive)- Returns:
- The random number
- Since:
- 21.23
-
randomBoolean
public boolean randomBoolean()Randomly generates a boolean value- Returns:
- The boolean value
-
randomEle
-
randomEle
public <T> T randomEle(@NonNull T[] array) -
randomEle
public int randomEle(int[] array) -
randomDouble
public double randomDouble()
-