Package com.prineside.tdi2.utils
Class FastRandom
java.lang.Object
com.prineside.tdi2.utils.FastRandom
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Сгенерировать случайный идентификатор.static String
getDistinguishableString
(int len, RandomXS128 random) static float
static int
getFairInt
(int maxExclusive) static float
getFloat()
static int
getInt
(int maxExclusive) static long
Unique number guaranteed if called with 0.01s minimum interval for 248.55 days.
-
Field Details
-
random
-
-
Constructor Details
-
FastRandom
public FastRandom()
-
-
Method Details
-
getFloat
public static float getFloat() -
getLongUUID
public static long getLongUUID()Unique number guaranteed if called with 0.01s minimum interval for 248.55 days. Don't call it frequently and don't use for things that may last 248+ days. For a long term UUID storage, make sure to check for collision first (32 bits from this UUID are securely random but it does not guarantee uniqueness) -
getInt
public static int getInt(int maxExclusive) -
getFairFloat
public static float getFairFloat() -
getFairInt
public static int getFairInt(int maxExclusive) -
getDistinguishableString
-
generateUniqueDistinguishableId
Сгенерировать случайный идентификатор. Это не гарантирует полной уникальности, вероятность колизии - 1 к 10^12 при вызове метода второй раз за ту же секунду
-