MCPcopy Index your code
hub / github.com/python/cpython / getran2

Method getran2

Lib/test/test_long.py:147–153  ·  view source on GitHub ↗
(ndigits)

Source from the content-addressed store, hash-verified

145 # BASE). The sign bit is also random.
146
147 def getran2(ndigits):
148 answer = 0
149 for i in range(ndigits):
150 answer = (answer << SHIFT) | random.randint(0, MASK)
151 if random.random() < 0.5:
152 answer = -answer
153 return answer
154
155 def check_division(self, x, y):
156 eq = self.assertEqual

Callers

nothing calls this directly

Calls 2

randintMethod · 0.80
randomMethod · 0.45

Tested by

no test coverage detected