-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is this a safe way to use ulid concurrently with other libraries too? #79
Comments
Here are a few links relevant to the topic of thread safe random number generation in Go:
If you don't care that there is contention on a locked random number generator across go-routines, use this: https://pkg.go.dev/golang.org/x/exp/rand#example-LockedSource. I will update the README with this recommendation, since it seems most users of If you find there's too much contention in your program in production (via profiling with |
I opened #80 to improve the README. |
As a follow up, here's a proposal for a |
The method described here is really fast! Can we use it with ulid? |
Of course. Just create an io.Reader that uses this as a source of entropy. |
Can you show me an example please? |
Merged #81 |
I just asked this question on SO. I'm posting this here too both for me and for for future "researchers".
I'm trying to use for the first time the ulid package.
In their README they say:
Can you help me understand what does this mean and how to write SAFE code for concurrent use with libraries such ent or gqlgen?
Example: I'm using the below code in my app to generate new IDs (sometimes even many of them in the same millisecond which is fine for
ulid
).Is this a safe way to use the package?
Can you help me better understand?
The text was updated successfully, but these errors were encountered: