mroth / weightedrand

:balance_scale: Fast weighted random selection for Go
MIT License
393 stars 50 forks source link

Nit: undeprecate PickSource #29

Open PointMeAtTheDawn opened 1 year ago

PointMeAtTheDawn commented 1 year ago

I do want to set my seed, unrelated to lock contention. I want consistent reproduction of my random results with the same seed. Seeding global rand is deprecated (for good reason), so PickSource is the only option using this library.

Keeping the note in the method doc makes sense, but marking the entire method deprecated leaves no supported route for this use case in the library.

mroth commented 1 year ago

Hmm, that’s fair. Deprecation in Go is just a documentation visibility thing at this time so your use case and code will still function as per the compatibility guarantee, but point taken.

I had been planning to re-add custom sources in a future version aligned with the new rand/v2 proposal (since the rand.source interface will change).

Towards designing that future api: In your use case, do you need the ability to use a different rand source on a per function call basis, or would the ability to set a randomness source for a chooser at creation be sufficient?

On Mon, Aug 14, 2023 at 3:21 PM PointMeAtTheDawn @.***> wrote:

I do want to set my seed, unrelated to lock contention. I want consistent reproduction of my random results with the same seed. Seeding global rand is deprecated (for good reason), so PickSource is the only option using this library.

Keeping the note in the method doc makes sense, but marking the entire method deprecated leaves no supported route for this use case in the library.

— Reply to this email directly, view it on GitHub https://github.com/mroth/weightedrand/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJ5SXBCVDLL6HEWEEYXHDXVJ3E7ANCNFSM6AAAAAA3QDY5XQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

PointMeAtTheDawn commented 1 year ago

Personally, setting at creation is sufficient for me.