Package de.mhus.lib.core.crypt
Class DefaultRandom
- java.lang.Object
-
- de.mhus.lib.core.crypt.DefaultRandom
-
-
Constructor Summary
Constructors Constructor Description DefaultRandom()
-
Method Summary
All Methods Instance Methods Concrete 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.RandomgetRandom()SecureRandomgetSecureRandom()protected doublerandom()Overwrite this to deliver your own random numbers
-
-
-
Method Detail
-
getByte
public byte getByte()
Description copied from interface:MRandomReturn a random byte from -127 to 128
-
getInt
public int getInt()
Description copied from interface:MRandomReturn a random integer from 0 to INTEGER MAX.
-
getDouble
public double getDouble()
Description copied from interface:MRandomReturn a random double from 0 to 1
-
getLong
public long getLong()
Description copied from interface:MRandomReturn a random long from 0 to LONG MAX.
-
random
protected double random()
Overwrite this to deliver your own random numbers- Returns:
-
getRandom
public Random getRandom()
-
adaptTo
public <T> T adaptTo(Class<? extends T> ifc)
Description copied from interface:MRandomReturn an adaption of an random if available. e.g. java.util.Random and java.security.Random should be supported.
-
getChar
public char getChar()
Description copied from interface:MRandomReturn a random readable character
-
getSecureRandom
public SecureRandom getSecureRandom()
- Specified by:
getSecureRandomin interfaceMRandom
-
-