Data race when using slicez.Shuffle and slicez.Sample concurrently
Closed this issue · 2 comments
larsve commented
The rand
changes in 96a84d8 is not concurrency safe, so if slicez.Shuffle
or slicez.Sample
is used concurrently, a data race may occur.
When operating directly on the rand
package, a lockedSource
is used internally to make the package methods concurrency safe, but rand.NewSource
return a rand.Source
that don't have any lock/mutex.
More information can be found here: golang/go#21393
crholm commented
probably should start out with just a lock since rand/v2 is not available in older versions of go