Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)