public class RandomUuidCreator extends AbstractUuidCreator implements NoArgumentsUuidCreator
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.| Modifier and Type | Field and Description |
|---|---|
protected Random |
random |
version, versionBits| 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 faster one.
|
RandomUuidCreator |
withRandomGenerator(Random random)
Replace the default random generator, in a fluent way, to another that
extends
Random. |
getVariantBits, getVersion, getVersionBits, setVariantBits, setVersionBitsprotected Random random
public UUID create()
create in interface NoArgumentsUuidCreatorpublic RandomUuidCreator withRandomGenerator(Random random)
Random.
The default random generator is SecureRandom.
For other faster pseudo-random generators, see XorshiftRandom and
its variations.
See Random.random - a random generatorRandomUuidCreatorpublic RandomUuidCreator withFastRandomGenerator()
Xorshift128PlusRandom and FingerprintUtil.getFingerprint()RandomUuidCreatorCopyright © 2020. All rights reserved.