MCPcopy
hub / github.com/golang/geo / randomFloat64

Function randomFloat64

s2/s2_test.go:126–129  ·  view source on GitHub ↗

randomFloat64 returns a uniformly distributed value in the range [0,1). Note that the values returned are all multiples of 2**-53, which means that not all possible values in this range are returned.

(r ...*rand.Rand)

Source from the content-addressed store, hash-verified

124// Note that the values returned are all multiples of 2**-53, which means that
125// not all possible values in this range are returned.
126func randomFloat64(r ...*rand.Rand) float64 {
127 const randomFloatBits = 53
128 return math.Ldexp(float64(randomBits(randomFloatBits, r...)), -randomFloatBits)
129}
130
131// randomUniformInt returns a uniformly distributed integer in the range [0,n).
132// NOTE: This is replicated here to stay in sync with how the C++ code generates

Calls 1

randomBitsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…