This function returns a function (closure) which generates
UUIDs. The state of that anonymous function is set when
uuid.gen is called. The state consists of the following:
- System and user information (
Sys.info) - Rversion (
R.version) - Platform information (
.Platform) - Working directory
- ProcessIDof theRsession
- Time when
uuid.genwas called (precision of seconds or
finer) - The text in parameter
more.state
The Pseudo Random Number Generator of R(see
.Random.seed) is used in the generation of
UUIDs. No initialization of the PRNG is done.
Tampering with the state of the RPRNG while using a given
UUID generator causes a risk of non-unique identifiers.
Particularly, setting the state of the PRNG to the same
value before two calls to the UUID generator guarantees two
identical identifiers. If two UUID generators have a
different state, it is not a problem to have the PRNG
going through or starting from the same state with both generators.
The user is responsible for selecting a PRNG with a
reasonable number of randomness. Usually, this doesn't require any
action. For example, any PRNG algorithm available in Rworks fine. However, the uniqueness of UUIDs can be
destroyed by using a bad user-supplied PRNG.
The UUIDs produced by uuid.gen generators are Version
4 (random) with 122 random bits and 6 fixed bits. The UUID
is presented as a character string of 32 hexadecimal digits and
4 hyphens:
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
where x is any hexadecimal digit and y is one of
"8", "9", "a", or "b". Each x and
y in the example is an independent variables (for all practical
purposes); subscripts are omitted for clarity. The UUID
generator gets 32 hex digits from the MD5 message digest
algorithm by feeding it a string consisting of the constant generator
state and 5 (pseudo) random numbers. After that, the 6 bits are fixed
and the hyphens are added to form the final UUID.