File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- //go:build baremetal && !(nrf || (stm32 && !(stm32f103 || stm32l0x1)) || (sam && atsamd51) || (sam && atsame5x) || esp32c3 || tkey || (tinygo.riscv32 && virt))
1+ //go:build baremetal && !(nrf || (stm32 && !(stm32f103 || stm32l0x1)) || (sam && atsamd51) || (sam && atsame5x) || esp32c3 || tkey || (tinygo.riscv32 && virt) || rp2040 || rp2350 )
22
33package runtime
44
Original file line number Diff line number Diff line change 1+ //go:build rp2040 || rp2350
2+
3+ package runtime
4+
5+ import "machine"
6+
7+ var hardwareRandValue uint64
8+
9+ func hardwareRand () (n uint64 , ok bool ) {
10+ if hardwareRandValue == 0 {
11+ n1 , _ := machine .GetRNG ()
12+ n2 , _ := machine .GetRNG ()
13+ hardwareRandValue = uint64 (n1 )<< 32 | uint64 (n2 )
14+ }
15+
16+ // Return ok=false to keep using fastrand64(),
17+ // with hardwareRandVal used only as its initial random state.
18+
19+ return hardwareRandValue , false
20+ }
You can’t perform that action at this time.
0 commit comments