Uuid96.RandomGenerator
Namespace: System · class
Generates 96-bit UUIDs using a secure random number generator
Remarks
Methods of this type are thread-safe.
Constructors
RandomGenerator
RandomGenerator()
Create a new instance of a random UUID generator
RandomGenerator(RandomNumberGenerator generator)
Create a new instance of a random UUID generator, using a specific random number generator
Methods
NewUuid
Uuid96 NewUuid()
Return a new random 96-bit UUID
Returns: Uuid96 that contains 96 bits worth of randomness.
This method needs to acquire a lock. If multiple threads needs to generate ids concurrently, you may need to create an instance of this class for each thread.The uniqueness of the generated uuids depends on the quality of the random number generator. If you cannot tolerate collisions, you either have to check if a newly generated uid already exists, or use a different kind of generator.
Fields
Default
static readonly RandomGenerator Default
Default instance of a random generator
Using this instance will introduce a global lock in your application. You can create specific instances for worker threads, if you require concurrency.