예제 #1
0
 def test_urandom(self):
     """urandom() returns random bytes"""
     for i in xrange(129):
         self.assertEqual(i, len(util.urandom(i)))
     # For a large enough sample, each value should appear at least once
     entropy = util.urandom(65536)
     values = set(ord(c) for c in entropy)
     self.assertEqual(256, len(values))
예제 #2
0
 def test_urandom(self):
     """urandom() returns random bytes"""
     for i in xrange(129):
         self.assertEqual(i, len(util.urandom(i)))
     # For a large enough sample, each value should appear at least once
     entropy = util.urandom(65536)
     values = set(ord(c) for c in entropy)
     self.assertEqual(256, len(values))