def __call__(self): """This generator yields points within the configuration space, some random, some not""" space = self.space part = self.part yield True, SPoint( self.begin, self.direction) ##first point gets special treatment for i in range(self.nos): if randint(1, part) > 1: #yield False,Vector(uniform(-5.,5.,(3,))) yield False, SPoint(space.uniformWithin()) else: yield False, SPoint(self.end)
def setUp(self): from opengltk.OpenGL import GL, GLUT print "GL imported from: ", GL.__file__ #print "Hit any key to quit." self.x = RandomArray.random( NUMDOTS) * 2 - 1 self.y = RandomArray.random( NUMDOTS) * 2 - 1 self.age = RandomArray.randint( 0,MAX_AGE, (NUMDOTS,)) move_length = 0.005 # 1.0 = screen width angle = 0 # in radians delta_angle = 0.2 # in radians self.move_x = move_length * Numeric.cos( angle) self.move_y = move_length * Numeric.sin( angle) self.halted = 0
def test_numeric_random(self, level=rlevel): """Ticket #552""" from numpy.oldnumeric.random_array import randint randint(0, 50, [2, 3])
def generateRandomSet(size): randSet = set() while len(randSet)<size: randSet.add(randint(0,1000000)) return list(randSet)
def test_numeric_random(self, level=rlevel): """Ticket #552""" from numpy.oldnumeric.random_array import randint randint(0,50,[2,3])
def randomDirection(self): return Vector( uniform(0.5, 1.5, (3, )) * (randint(0, 1, (3, )) * 2 - 1)).normal()
def setImageRights(self): imageRights = self.driver.find_element_by_xpath("//*[@id='image_rights']") option = imageRights.find_elements_by_tag_name('option') option[randint(0, len(option)-1)].click()
def setImageCopyright(self): imageCopyRight = self.driver.find_element_by_xpath("//*[@id='image_provider']") option = imageCopyRight.find_elements_by_tag_name('option') option[randint(0, len(option)-1)].click()