This change uses linkname for the one random function
internal/concurrent needs to avoid taking a dependency on math/rand/v2.
This lowers the bar to using this package.
Change-Id: I9dba1121b66ba35f56521643937f220936ea5321
Reviewed-on: https://go-review.googlesource.com/c/go/+/594057
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
< internal/godebug
< internal/reflectlite
< errors
- < internal/oserror;
+ < internal/oserror
+ < internal/concurrent;
cmp, runtime, math/bits
< iter
MATH
< runtime/metrics;
- RUNTIME, math/rand/v2
- < internal/concurrent;
-
MATH, unicode/utf8
< strconv;
import (
"internal/abi"
"internal/goarch"
- "math/rand/v2"
"sync"
"sync/atomic"
"unsafe"
keyHash: mapType.Hasher,
keyEqual: mapType.Key.Equal,
valEqual: mapType.Elem.Equal,
- seed: uintptr(rand.Uint64()),
+ seed: uintptr(runtime_rand()),
}
return ht
}
}
return (*indirect[K, V])(unsafe.Pointer(n))
}
+
+// Pull in runtime.rand so that we don't need to take a dependency
+// on math/rand/v2.
+//
+//go:linkname runtime_rand runtime.rand
+func runtime_rand() uint64