github.com/lemon-mint/libuseful@v1.3.1-0.20220724073654-ee73785d5aa0/fastrand.go (about) 1 package libuseful 2 3 import ( 4 _ "unsafe" 5 ) 6 7 // FastRand32 implements the xorshift64+ algorithm 8 func FastRand32() uint32 9 10 // FastRand32n is similar to FastRand32() % n, but faster. 11 func FastRand32n(n uint32) uint32 12 13 //go:linkname FastRand32 runtime.fastrand 14 //go:linkname FastRand32n runtime.fastrandn