RobThree / NUlid

.Net ULID implementation
MIT License
364 stars 25 forks source link

Fixing monotonic to avoid duplicates #17

Closed cyrusdargahi closed 2 years ago

cyrusdargahi commented 2 years ago

Under high concurrency, current MontonicUlidRng implementation can cause duplicate Ulids to be generated. Although the GetRandomBytes methods uses a lock to increment the random number, it returns the reference to the original byte[] and during high concurrency situations it could lead to exact same values to be read from the returned byte[].

RobThree commented 2 years ago

Thank you very much! 🙌 Published as 1.7.0