Package de.mhus.lib.core.crypt
Interface MRandom
-
- All Known Implementing Classes:
DefaultRandom
public interface MRandom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TadaptTo(Class<? extends T> ifc)Return an adaption of an random if available.bytegetByte()Return a random byte from -127 to 128chargetChar()Return a random readable characterdoublegetDouble()Return a random double from 0 to 1intgetInt()Return a random integer from 0 to INTEGER MAX.longgetLong()Return a random long from 0 to LONG MAX.SecureRandomgetSecureRandom()
-
-
-
Method Detail
-
getByte
byte getByte()
Return a random byte from -127 to 128- Returns:
- a random yte
-
getInt
int getInt()
Return a random integer from 0 to INTEGER MAX.- Returns:
- a random integer
-
getDouble
double getDouble()
Return a random double from 0 to 1- Returns:
- random double
-
getLong
long getLong()
Return a random long from 0 to LONG MAX.- Returns:
- random long
-
adaptTo
<T> T adaptTo(Class<? extends T> ifc) throws de.mhus.lib.errors.NotSupportedException
Return an adaption of an random if available. e.g. java.util.Random and java.security.Random should be supported.- Parameters:
ifc- Requested Interface or Class- Returns:
- The instance of Ifc
- Throws:
de.mhus.lib.errors.NotSupportedException- If adaption was not possible.
-
getChar
char getChar()
Return a random readable character- Returns:
- random character
-
getSecureRandom
SecureRandom getSecureRandom()
-
-