21
submitted 9 months ago* (last edited 9 months ago) by [email protected] to c/[email protected]

I couldn't sleep. Also I don't know how to deal with formatting this because of the apostrophes and I don't care that much

Function CreateUUIDv4$ ()
' this routine generates about 23 guids per second at 4.77 MHz

' define a UUID string template
Dim result As String * 36
result = "00000000-0000-0000-0000-000000000000"
'         123456789012345678901234567890123456

Dim substring$
Dim index%, offset%

' enumerate the indices where we should insert values
For index% = 1 To 33 Step 4

    ' skip over the separators
    If index% = 9 Or index% = 14 Or index% = 19 Or index% = 24 Then
        index% = index% + 1
    End If

    ' generate a value from 0x0000 to 0xFFFF
    substring$ = Hex$(Int((&HFFFF& - 0 + 1) * Rnd + 0))

    ' add an offset that permits leading zeroes if the hex representation
    ' of the value to insert is less than 4 characters
    offset% = 4 - Len(substring$)

    ' insert the substring at the specified location
    Mid$(result, index% + offset%) = substring$
Next

' version 4 (random data)
Mid$(result, 15) = "4"

' variant DCE 1.1, ISO/IEC 11578:1996 (0x1000 - 0x1011)
Mid$(result, 20) = Hex$(Int(Rnd * 4 + 8))

CreateUUIDv4$ = result

End Function

[-] [email protected] 82 points 9 months ago

I think this is funny, but it's hard for me to hate too much on flatpaks. Disk space is practically free now, and having spent a good chunk of my career fighting DLL hell, I have a lot of sympathy for the problem it's trying to solve.

[-] [email protected] 187 points 10 months ago

I'd like to see a law where this immediately dissolves the company.

view more: next ›

m_r_butts

joined 1 year ago