fix: resolve data race in token.RNG global

Wrap *rand.Rand in a mutex-protected SafeRand type to make the global
RNG safe for concurrent use across goroutines. The previous bare
*rand.Rand caused data races detected by go test -race.
This commit is contained in:
Houmgaor
2026-02-16 18:19:18 +01:00
parent 9b69564c49
commit a7b0deaa42
4 changed files with 44 additions and 22 deletions

View File

@@ -539,7 +539,7 @@ func TestDiffItemStacks_GeneratesNewWarehouseID(t *testing.T) {
}
// Reset RNG for consistent test
token.RNG = token.NewRNG()
token.RNG = token.NewSafeRand()
result := DiffItemStacks(old, update)
if len(result) != 1 {