public class RandomBasedGenerator extends NoArgGenerator
 Note on random number generation when using SecureRandom for random number
 generation: the first time SecureRandom object is used, there is noticeable delay between
 calling the method and getting the reply. This is because SecureRandom
 has to initialize itself to reasonably random state. Thus, if you
 want to lessen delay, it may be be a good idea to either get the
 first random UUID asynchronously from a separate thread, or to
 use the other generateRandomBasedUUID passing a previously initialized
 SecureRandom instance.
| Modifier and Type | Field and Description | 
|---|---|
protected Random | 
_random
Random number generator that this generator uses. 
 | 
protected boolean | 
_secureRandom
Looks like  
SecureRandom implementation is more efficient
 using single call access (compared to basic Random),
 so let's use that knowledge to our benefit. | 
protected static Random | 
_sharedRandom
Default shared random number generator, used if no random number generator
 is explicitly specified for instance 
 | 
| Constructor and Description | 
|---|
RandomBasedGenerator(Random rnd)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected static long | 
_toLong(byte[] buffer,
       int offset)  | 
UUID | 
generate()  | 
UUIDType | 
getType()
Accessor for determining type of UUIDs (version) that this
 generator instance will produce. 
 | 
protected static Random _sharedRandom
protected final Random _random
protected final boolean _secureRandom
SecureRandom implementation is more efficient
 using single call access (compared to basic Random),
 so let's use that knowledge to our benefit.public RandomBasedGenerator(Random rnd)
rnd - Random number generator to use for generating UUIDs; if null,
   shared default generator is used. Note that it is strongly recommend to
   use a good (pseudo) random number generator; for example, JDK's
   SecureRandom.public UUIDType getType()
UUIDGeneratorgetType in class UUIDGeneratorpublic UUID generate()
generate in class NoArgGeneratorprotected static final long _toLong(byte[] buffer,
                                    int offset)
Copyright © 2023 FasterXML.com. All rights reserved.