Option Public Option Base 0 Sub Initialize Print "

LotusScript UUID Generator

" Print "" Print "" Print || Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "" Print "
Function CalledValue Returned
UUID(0,0)" + UUID(0,0) + "
UUID(10,2)" + UUID(10,2) + "
UUID(10,10)" + UUID(10,10) + "
UUID(10,16)" + UUID(10,16) + "
UUID(14,10)" + UUID(14,10) + "
UUID(14,16)" + UUID(14,16) + "
UUID(14,0)" + UUID(14,0) + "
UUID(1,0)" + UUID(1,0) + "
UUID(2,0)" + UUID(2,0) + "
UUID(3,0)" + UUID(3,0) + "
UUID(4,0)" + UUID(4,0) + "
UUID(5,0)" + UUID(5,0) + "
UUID(6,0)" + UUID(6,0) + "
UUID(7,0)" + UUID(7,0) + "
UUID(8,0)" + UUID(8,0) + "
UUID(9,0)" + UUID(9,0) + "
UUID(10,0)" + UUID(10,0) + "
UUID(11,0)" + UUID(11,0) + "
UUID(12,0)" + UUID(12,0) + "
UUID(13,0)" + UUID(13,0) + "
UUID(14,0)" + UUID(14,0) + "
UUID(15,0)" + UUID(15,0) + "
UUID(16,0)" + UUID(16,0) + "
UUID(17,0)" + UUID(17,0) + "
UUID(18,0)" + UUID(18,0) + "
UUID(19,0)" + UUID(19,0) + "
UUID(20,0)" + UUID(20,0) + "
UUID(21,0)" + UUID(21,0) + "
UUID(22,0)" + UUID(22,0) + "
UUID(23,0)" + UUID(23,0) + "
UUID(24,0)" + UUID(24,0) + "
UUID(25,0)" + UUID(25,0) + "
UUID(26,0)" + UUID(26,0) + "
UUID(27,0)" + UUID(27,0) + "
UUID(28,0)" + UUID(28,0) + "
UUID(29,0)" + UUID(29,0) + "
UUID(30,0)" + UUID(30,0) + "
UUID(31,0)" + UUID(31,0) + "
UUID(32,0)" + UUID(32,0) + "
" Print |

This code is ported from this JavaScript.

| Print |

Back to DEXT -- Codestore.net

| End Sub Function UUID (length As Integer, radix As Integer) As String 'Private array of chars to use Dim chars As Variant Chars = Split("0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",") Dim i As Integer Dim theuuid(36) As String If length>0 Then 'Compact form If radix=0 Then radix = Ubound(chars) For i = 1 To length theuuid(i) = chars(Rnd()*(radix-1)) Next Else 'RFC4122, version 4 form Dim r As Double 'rfc4122 requires these characters theuuid(9) = "-" theuuid(14) = "-" theuuid(19) = "-" theuuid(24) = "-" theuuid(15) = "4" 'Fill in random data. At i=20 set the high bits of clock sequence as 'per rfc4122, sec. 4.1.5 For i = 1 To 36 If theuuid(i)="" Then r = Round(Rnd()*15,0) If i=20 Then theuuid(i) = chars( ( r And &H3 ) Or &H8 ) Else theuuid(i) = chars( r And &HF ) End If End If Next End If UUID = Join(theuuid, "") End Function