github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/rand_hwrng.go (about) 1 //go:build baremetal && (nrf || (stm32 && !(stm32f103 || stm32l0x1)) || (sam && atsamd51) || (sam && atsame5x) || esp32c3) 2 3 // If you update the above build constraint, you'll probably also need to update 4 // src/crypto/rand/rand_baremetal.go. 5 6 package runtime 7 8 import "machine" 9 10 func hardwareRand() (n uint64, ok bool) { 11 n1, err1 := machine.GetRNG() 12 n2, err2 := machine.GetRNG() 13 n = uint64(n1)<<32 | uint64(n2) 14 ok = err1 == nil && err2 == nil 15 return 16 }