File tree 2 files changed +4
-7
lines changed 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,10 @@ import (
13
13
)
14
14
15
15
// provided by runtime
16
- func fastrand () uint32
16
+ func fastrandu () uint
17
17
18
18
func randInt () int {
19
- x , y := fastrand (), fastrand () // 32-bit halves
20
- u := uint (x )<< 31 ^ uint (int32 (y )) // full uint, even on 64-bit systems; avoid 32-bit shift on 32-bit systems
21
- i := int (u >> 1 ) // clear sign bit, even on 32-bit systems
22
- return i
19
+ return int (fastrandu () >> 1 ) // clear sign bit
23
20
}
24
21
25
22
func randIntn (n int ) int {
Original file line number Diff line number Diff line change @@ -199,8 +199,8 @@ func fastrandu() uint {
199
199
//go:linkname sync_fastrandn sync.fastrandn
200
200
func sync_fastrandn (n uint32 ) uint32 { return fastrandn (n ) }
201
201
202
- //go:linkname net_fastrand net.fastrand
203
- func net_fastrand () uint32 { return fastrand () }
202
+ //go:linkname net_fastrandu net.fastrandu
203
+ func net_fastrandu () uint { return fastrandu () }
204
204
205
205
//go:linkname os_fastrand os.fastrand
206
206
func os_fastrand () uint32 { return fastrand () }
You can’t perform that action at this time.
0 commit comments