4 ms·
It's seeded using the CPU tick counter (RDTSC on x86-64), which is sufficiently random (billions of increments per second of uptime!) for this. https://cs.open
by Scaevolus 4y ago
It's seeded using the CPU tick counter (RDTSC on x86-64), which is sufficiently random (billions of increments per second of uptime!) for this.
https://cs.opensource.google/go/go/+/refs/tags/go1.20:src/math/rand/rand.go;l=415 https://cs.opensource.google/go/go/+/refs/tags/go1.20:src/ma...
https://cs.opensource.google/go/go/+/release-branch.go1.20:src/runtime/stubs.go;l=132 https://cs.opensource.google/go/go/+/release-branch.go1.20:s...
https://cs.opensource.google/go/go/+/release-branch.go1.20:src/runtime/proc.go;l=827 https://cs.opensource.google/go/go/+/release-branch.go1.20:s...
https://cs.opensource.google/go/go/+/master:src/runtime/asm_amd64.s;l=1078 https://cs.opensource.google/go/go/+/master:src/runtime/asm_...
- cpeterso 4y agoI’m surprised they don’t just seed using /dev/urandom (or the platform specific analogue).