def testRandbitsError(self): r = _fastrand.randbits(-1, 64) # TODO: Should probably raise exceptions self.assertEqual(None, r) r = _fastrand.randbits(0.0, 65) self.assertEqual(None, r)
def testRandbits64_EdgeCases(self): for n in BIT_WIDTHS: r = _fastrand.randbits(0.0, n) self.assertEqual(0, r) for n in BIT_WIDTHS: r = _fastrand.randbits(1.0, n) self.assertEqual(2 ** n - 1, r)
def testRandbits64_EdgeCases(self): for n in BIT_WIDTHS: r = _fastrand.randbits(0.0, n) self.assertEqual(0, r) for n in BIT_WIDTHS: r = _fastrand.randbits(1.0, n) self.assertEqual(2**n - 1, r)
def testRandbits64(self): for n in [8, 16, 32, 64]: #print '== %d' % n for p1 in [0.1, 0.5, 0.9]: #print '-- %f' % p1 for i in xrange(5): r = _fastrand.randbits(p1, n) # Rough sanity check self.assertLess(r, 2**n)
def testRandbits64(self): for n in BIT_WIDTHS: #print '== %d' % n for p1 in [0.1, 0.5, 0.9]: #print '-- %f' % p1 for i in xrange(5): r = _fastrand.randbits(p1, n) # Rough sanity check self.assertLess(r, 2 ** n)