--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why do you want to share a random source? Is it because obtaining a new properly seeded random source is too complicated? If that is the case. It would seem better to solve that problem instead.
Thanks
Dave
This proposal was never accepted or rejected, but it remains relevant. I'd like to resuscitate it.In the original thread, Dave Cheney questioned why anyone would want a shared random source. The use case that brought me here seems common: I have an object that's supposed to be thread-safe and has a method that needs to generate random numbers. Because the method may be called from multiple goroutines, I can't use a Source returned by rand.NewSource. But in testing my object, I want to use dependency injection, so I can't use the default locked source.I'd be happy to create a pull request adding "NewLockedSource(seed inte64) Source" if people think this is reasonable.