Version 3.1.0
>>> from ulid import ULID
>>>
>>> prev = None
>>> for i in range(2_000_000):
... u = str(ULID())
... if prev is not None and u < prev:
... print(f"drop at {i}:")
... print(f" prev={prev} ts={prev[:10]} rand={prev[10:]}")
... print(f" curr={u} ts={u[:10]} rand={u[10:]}")
... break
... prev = u
...
drop at 17:
prev=01KT6JE36AYQD46B7SP5T0K6K9 ts=01KT6JE36A rand=YQD46B7SP5T0K6K9
curr=01KT6JE36A9KNN12R9RC3JDJK0 ts=01KT6JE36A rand=9KNN12R9RC3JDJK0
You can see that the rand part's lexicographic sorting has gone down (9 < Y) and it bailed after 17 iterations.
Version 3.1.0
You can see that the
randpart's lexicographic sorting has gone down (9<Y) and it bailed after 17 iterations.