One could also use GUIDs/UUIDs for seeds.
In Linux:
`cat /proc/sys/kernel/random/uuid` or `uuidgen`
In Windows with PowerShell installed:
`PowerShell -NoProfile [guid]::NewGuid().ToString()`
Both ways would require you to output to a file or use pipecom to capture the stdout.
You could also use the WinAPI to generate version 1 (sequential and based on MAC address) and version 4 (random) UUIDs.
The above terminal command options generate version 4 UUIDs, which are truly unique and don't reveal your MAC address.
You could also use the new HTTP options in QB64PE to do a simple GET request with the uuidtools REST API. It can generate versions 3 and 5 and create the UUIDs based on a hash of a provided string. UUIDs made this way are NOT random and can be created repeatedly. Can be handy to verify input against a stored UUID.
EDIT - Using the uuidtools REST API:
Code: (Select All)
Function UUIDVer3$ (mode As Integer, StringToHash As String)
Dim As String UUID, URL, location
'Dim As GUID GUID
Dim As Long status
location = "/api/generate/v3/namespace/"
Select Case mode
Case 1
location = location + "ns:dns/name/"
Case 2
location = location + "ns:url/name/"
Case 3
location = location + "ns:oid/name/"
Case 4
location = location + "ns:x500/name/"
End Select
Dim As Long client: client = _OpenClient("HTTP:" + "https://www.uuidtools.com" + location + StringToHash)
If client Then
If _StatusCode(client) = 200 Then
Dim As String buf, content
While Not EOF(client)
Get client, , buf
content = content + buf
Wend
Close client
UUID = UCase$(Mid$(_Trim$(content), 3, 36))
End If
End If
'StringToUUID UUID, GUID
'GUIDHash = UuidHash(GUID, status)
UUIDVer3 = UUID
End Function
Function UUIDVer5$ (mode As Integer, StringToHash As String)
Dim As String UUID, URL, location
'Dim As GUID GUID
Dim As Long status
location = "/api/generate/v5/namespace/"
Select Case mode
Case 1
location = location + "ns:dns/name/"
Case 2
location = location + "ns:url/name/"
Case 3
location = location + "ns:oid/name/"
Case 4
location = location + "ns:x500/name/"
End Select
Dim As Long client: client = _OpenClient("HTTP:" + "https://www.uuidtools.com" + location + StringToHash)
If client Then
If _StatusCode(client) = 200 Then
Dim As String buf, content
While Not EOF(client)
Get client, , buf
content = content + buf
Wend
Close client
UUID = UCase$(Mid$(_Trim$(content), 3, 36))
End If
End If
'StringToUUID UUID, GUID
'GUIDHash = UuidHash(GUID, status)
UUIDVer5 = UUID
End Function