Skip to content

Commit e914cd3

Browse files
authored
Add note about ULIDs not being random in one case
Without reading the ULID specification, it is not obvious in this documentation that the random portion of a ULID is not entirely random when multiple are generated in the same millisecond.
1 parent b300df4 commit e914cd3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/uid.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ ULIDs are an alternative to UUIDs when using those is impractical. They provide
209209
128-bit compatibility with UUID, they are lexicographically sortable and they
210210
are encoded as 26-character strings (vs 36-character UUIDs).
211211

212+
.. note::
213+
214+
If you generate more than one ULID during the same millisecond then the random
215+
portion is incremented by one bit in order to provide monotonicity for sorting.
216+
The random portion is **not** random compared to the previous ULID in this case.
217+
212218
Generating ULIDs
213219
~~~~~~~~~~~~~~~~
214220

0 commit comments

Comments
 (0)