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

Method test_gauss

Lib/test/test_random.py:368–383  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

366 self.gen.choices('AB', [float('-inf'), float('inf')])
367
368 def test_gauss(self):
369 # Ensure that the seed() method initializes all the hidden state. In
370 # particular, through 2.2.1 it failed to reset a piece of state used
371 # by (and only by) the .gauss() method.
372
373 for seed in 1, 12, 123, 1234, 12345, 123456, 654321:
374 self.gen.seed(seed)
375 x1 = self.gen.random()
376 y1 = self.gen.gauss(0, 1)
377
378 self.gen.seed(seed)
379 x2 = self.gen.random()
380 y2 = self.gen.gauss(0, 1)
381
382 self.assertEqual(x1, x2)
383 self.assertEqual(y1, y2)
384
385 @support.requires_IEEE_754
386 def test_53_bits_per_float(self):

Callers

nothing calls this directly

Calls 4

gaussMethod · 0.80
seedMethod · 0.45
randomMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected