GUID generator
Mark Smith
mark at maseurope.net
Sat Jun 21 07:11:56 EDT 2008
Sivakatirswami, the question is how unique do you need it to be -
this is not a simple question :)
if you need it to be unique only in your own domain (as it were),
then your function is probably fine, but if it needs to be unique in
the wider world, then maybe not.
The little library ( http://www.futility.co.uk/futsoft/
revolutionstuff.html ) that I wrote follows the relevant RFC - so, in
theory, it's output has 'wider' uniqueness - the subject is quite
involved, when you get into it.
Best Mark
On 21 Jun 2008, at 05:12, Sivakatirswami wrote:
> I'm building a PicLens Publisher here that will do pretty much what
> the current PicLens Publisher does from CoolIris, with some
> additions to their Media RSS format that their app does not do.
> (see www.piclens.com)
>
> One thing I need to emulate is their GUID (Global Unique ID)
> generator which outputs unique len(36) random strings like
>
> 557B4610-65DC-4FEA-B6DC-32C3FA4B374D
>
> 24D2C85A-DD13-4B5D-9CCF-8F3ADC3E6CC7
>
> 6B8CD7AA-11B5-4A0D-8EF1-0D6B18C80A17
>
> 0B7815AE-AC47-457D-B2CA-F0280947220D
>
> there is no significance to these strings other than that the
> uniqueness of the string being close to infinity i.e. unlikely
> every to be duplicated again.
>
> This is something brand new for me... I'm curious if anyone knows
> the patterns here or has any idea of the algorithm being used. It
> does appear that the alpha chars are always a) caps b) never go
> beyond F This hints at a hexidecimal system underlying the algorithm.
> I presume one could request a random selection from the hex set:
> 0123456789ABCDEF
> and call this 36 times. i don't know why there is any need for
> hyphenated segments other than for readability....
>
> But, it's pretty simple to write a generator the appears to emulate
> the algorithm.. I have this so far and it seems to do the job...
> any insights?
>
> on mouseUp
> repeat 5 times
> repeat 9 times
> put GetRandomHex() after tGUID
> end repeat
> put "-" after tGUID
> repeat 3 times
> repeat 4 times
> put GetRandomHex() after tGUID
> end repeat
> put "-" after tGUID
> end repeat
> repeat 12 times hexSet [tPickAnyOne]
> put GetRandomHex() after tGUID
> end repeat
> put tGUID & cr after tOutPut
> put empty into tGUID
> end repeat
> put tOutPut
> end mouseUp
>
> function GetRandomHex
> put "0 1 2 3 4 5 6 7 8 9 A B C D E F" into hexSet
> split hexSet by " "
> put random(16) into tPickAnyOne
> return hexSet [tPickAnyOne]
> end GetRandomHex
>
> delivers
>
> F2ACEA9EB-C3A5-F4CE-05B5-92888E1E80FA
> 66A5365D3-EF9A-EF00-66EB-6C82663130B7
> 65634AD6D-8577-A757-310F-47287CF85389
> E2A1DC66D-C58C-1F26-26BF-35EA95A46B5C
> BC04061AC-E3C5-3DEC-6EF3-7397B7757F8A
>
>
> Seem OK?
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list