Example #1
0
 def random(self):
     """Get a random point in binary space. Use the constraint to 
     generate a random point in the space if possible, otherwise
     use a random byte string.
     
     """
     return TernaryString.random(self.dim)
Example #2
0
 def random(self):
     """Get a random point in binary space. Use the constraint to 
     generate a random point in the space if possible, otherwise
     use a random byte string.
     
     """
     return TernaryString.random(self.dim)
Example #3
0
 def test_random(self):
    total = np.zeros(100)
    for i in xrange(10000):
       total += TernaryString.random(100).toArray() / 10000.0
    print "Total max: ", 
    self.assertTrue(np.abs(total - .5).max() < .025)
Example #4
0
 def test_random(self):
     total = np.zeros(100)
     for i in xrange(10000):
         total += TernaryString.random(100).toArray() / 10000.0
     print "Total max: ",
     self.assertTrue(np.abs(total - .5).max() < .025)