Description RNG safe Author(s) References See Also Examples
The string "bird.carp.7TsBWtwqtKAeCTNk8f" is a "QQID": a representation of a 128-bit number, constructed from two "cues" of short, common, English words, and Base64 encoded characters. The primary intended use of QQIDs is as random unique identifiers, e.g. database keys like the "UUIDs" defined in the RFC 4122 Internet standard. QQIDs can be identically interconverted with UUIDs, IPv6 addresses, MD5 hashes etc., and are suitable for a host of applications in which identifiers are read by humans. They are compact, can safely be transmitted in binary and text form, can be used as components of URLs, and it can be established at a glance whether two QQIDs are different or potentially identical. The qqid package contains functions to retrieve true, quantum-random QQIDs, to generate pseudo- random QQIDs, to validate them, and to interconvert them with other 128-bit number representations.
Care has been taken to ensure that the qqid
functions have little risk of inadvertently changing the RNG's global
initialization state .Random.seed
. Your random-reproducible
simulation should not be affected if you generate a few QQIDs in-between.
(c) 2019 Boris Steipe,
licensed under MIT (see file LICENSE
in this package).
See the
qqid
README
on the Web for more Details. DOI:10.5281/zenodo.2648318
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # Use rngQQID() to get a few QQIDS with R's internal RNG
rngQQID(7, method = "R")
# That's fine, but it's better to initialize the RNG with a true-random
# number. You need to be connected to the Internet ...
## Not run:
rngQQID(7, method = "q")
# ... of course you won't really notice
# the difference. Except that it takes a
# few seconds to fetch the random seed from
# the quantum-random number server at the
# Australian National University in Canberra
## End(Not run)
# The best way is to fetch a block of true-random numbers from the ANU
# in Canberra and to cache them in a closure...
## Not run:
qQQID <- qQQIDfactory() # takes a few seconds to fabricate the closure
# then, getting QQIDs works without latency
qQQID(1)
qQQID(1)
qQQID(2)
qQQID(3)
qQQID(5)
qQQID(8)
# if you are curious, you can peek what's next in the cache...
qQQID(5, inspectOnly = TRUE)
# (the numbers are not returned, only
# message()'d so you can't accidentally
# assign them)
# ... and then retrieve some of those numbers
qQQID(2)
# of course, these two are now no longer on the cache.
qQQID(5, inspectOnly = TRUE)
# Now, you have just looked at a dozen of 128-bit random numbers, and had
# no trouble figuring out which ones were the same, and which ones were
# different. That's the point of QQIDs.
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.