"Trevor Talbot" <[EMAIL PROTECTED]> wrote: > > > > sqlite> select "{" || hex(randomblob(4)) || "-" || hex(randomblob(2)) > > > || "-" || hex(randomblob(2)) || "-" || hex(randomblob(2)) || "-" || > > > hex(randomblob(6)) || "}"; > > > {4EA4A842-6ACA-0A81-5B42-F9E1D295BC27} > > Note that this is *NOT* a GUID/UUID. Be very sure of your > requirement: if you need a GUID, write a function that uses your > platform tools to get one. If you just need some long random > identifier, the above is fine, but don't call it a GUID. See RFC > 4122. >
Please reread RFC-4122, especially section 4.4. While Chase's guid is technically in violation of RFC-4122 in that it contains 4 extra bits of randomness, it is very close. And in a sense, the extra 4 bits of randomness provide a stronger GUID than RFC-4122 specifies. I personally find all the syntax in RFC-4122 to be annoying and so I usually do my GUIDs using hex(randomblob(20)). But I guess that is just personal preference. Note that SQLite contains a decent PRNG which is well seeded, if you are running on Mac or Linux. (We need to work on better seeding on Win32...) -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------