Hacker News new | past | comments | ask | show | jobs | submit login

Don't even need the "same millisecond" part to save a few cycles, use case depending. An overflowing increment with a counter of any sort plus a few random bits is usually enough.

If you're clever enough, neither needs a branch.




UUIDv7 has two at least two such monotonic strategies. You can use a counter, or you can use those bytes to increase the random entropy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: