github.com/chaowen112/go-lib@v0.0.0-20231018124935-124cd26d7cbe/randutils/uint32.go (about) 1 package randutils 2 3 import ( 4 _ "unsafe" // for runtime.fastrandn 5 ) 6 7 // Uint32n returns a pseudorandom uint32 in [0,n). 8 // 9 //go:noescape 10 //go:linkname Uint32n runtime.fastrandn 11 func Uint32n(n uint32) uint32 12 13 // Uint32 returns a pseudorandom uint32. 14 // 15 //go:noescape 16 //go:linkname Uint32 runtime.fastrand 17 func Uint32() uint32