v2.0.0
🎉 weightedrand
now utilizes generics for the container data structure to clean up the API and improve end-user ergonomics, thus typecasting is no longer required when obtaining your result, and can utilize any integer type for scores.
This requires a tiny code change if upgrading from a previous version (most likely just removing now unneeded typecasts), and manual upgrading of your import path to include the /v2
(see https://golang.cafe/blog/how-to-upgrade-to-a-major-version-in-go.html).
E.g. what used to be:
result := chooser.Pick().(type)
Can now simply be expressed as:
result := chooser.Pick()
This also means that the current version of the library requires go >= 1.18. For previous versions, you can continue to rely upon v1
of this library. The go module versioning system ensures you will not be automatically upgraded to a new major version without manual action.
What's Changed
Full Changelog: v1.0.0...v2.0.0