public class RandomUuidCreator extends AbstractUuidCreator
SecureRandom, but it
can be replaced by any random generator that extends
Random.
Some fast random generators are provided along with this project, for
example, Xorshift128PlusRandom, which is default RNG for some web
browsers.NIL_UUID, RFC4122_VARIANT_BITS, RFC4122_VERSION_BITS, version| Constructor and Description |
|---|
RandomUuidCreator() |
| Modifier and Type | Method and Description |
|---|---|
UUID |
create()
Return a UUID with random value.
### RFC-4122 - 4.4.
|
RandomUuidCreator |
withFastRandomGenerator()
Replaces the default random generator with a fester one.
|
RandomUuidCreator |
withRandomGenerator(Random random)
Replace the default random generator, in a fluent way, to another that
extends
Random. |
getVariantBits, getVersion, getVersionBits, setVariantBits, setVersionBits, validpublic UUID create()
public RandomUuidCreator withRandomGenerator(Random random)
Random.
The default random generator is SecureRandom with
SHA1PRNG algorithm.
For other faster pseudo-random generators, see XorshiftRandom and
its variations.
Random.random - a random generatorRandomUuidCreatorpublic RandomUuidCreator withFastRandomGenerator()
Xorshift128PlusRandomRandomUuidCreatorCopyright © 2019. All rights reserved.