Here is a method to create a UUID:
newuuid = function({},
//following procedure here: https://www.cryptosys.net/pki/uuid-rfc4122.html
strout = "";
//guid made from 16 hex bytes
for(i=1, i<=16, i++,
thisint = random integer(256) - 1;
thisbyte = right(hex(thisint,"integer"),2);
if( i == 7, //the four most significant bits of the of the 7th byte are 0100
thisbyte = char(4) || right(thisbyte,1),
i == 9, //the two most significant bits of the 9th byte are 01
//decimal to binary
bin = "";
value = thisint;
While(value,
bin = Char(Modulo(Num(value), 2)) || bin;
value = Floor(value / 2);
);
//fix digits
bin = right(bin,8,"0");
bin = "10" || right(bin, 6);
//back to decimal
dec = 0;
While(length(bin) > 0,
dec = dec + (num(left(bin, 1))*2)^(num(length(bin))-1);
bin = right(bin, length(bin) - 1);
);
//to hex
thisbyte = right( hex( dec, "integer" ), 2 );
);
strout = strout || thisbyte;
);
//format output
substr(strout,1,8) ||
"-" || substr(strout,9,4) ||
"-" || substr(strout,13,4)||
"-" || substr(strout,17,4) ||
"-" || substr(strout,21,12);
);
newuuid();
Disclaimer: I believe I blindly followed this link and I didn't do extensive testing...