Fairly often in XMPP you will want to generate pseudo-random, unique identifiers. The uuid library provides this functionality.
local uuid = require "util.uuid"; print("Your id is:", uuid.generate())
Returns an id, in the form of a string.
Note: In Prosody 0.4 and earlier, there was no guarantee that a generated id will actually be unique. In 0.5 and later a string in the UUIDv4 format is returned, however with a dubious PRNG. As of Prosody 0.9.9,
/dev/urandom is used as PRNG.