Android Question Guid - how long before same id returned?

We're using the code below, based on the thread:

B4X:
Sub GUID As String
    'Dim stp As String = "00000000-0000-1000-a000-000000000000" 'original
    Dim stp As String = "00000000-0000-1000-a000-00000" 'little bit shorter then in the thread
    Dim sb As String = ""
 
    For Index = 0 To stp.Length-1
        If stp.CharAt(Index)="0" Then
            sb=sb & "0123456789ABCDEF".CharAt(Rnd(0, 16))
        Else
            sb=sb & stp.CharAt(Index)
        End If
    Next
    
    Return sb.ToUpperCase
End Sub

Now we where wondering when the same ID returns? If we compare this in our database along with date and programlicense wil it stay unique for (more than) a day?
Our app is installed 500+ devices
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
If you were to allocate one of your reduced GUID values every second then you would have enough different values to last you one hundred billion times the life of the universe so far. This should give you some idea of the likelihood of repeating a value in the same day.
 
Last edited:
Upvote 0
Top