Skip to content
Permalink
Browse files
init random generator before creating points
  • Loading branch information
alexbruy committed May 16, 2014
1 parent 9f4e107 commit 9b4b1df68fea36fbafcfb1ba7458b0a0d4dc81d6
@@ -83,6 +83,8 @@ def processAlgorithm(self, progress):
index = QgsSpatialIndex()
points = dict()

random.seed()

while nIterations < maxIterations and nPoints < pointCount:
rx = xMin + (xMax - xMin) * random.random()
ry = yMin + (yMax - yMin) * random.random()
@@ -84,6 +84,8 @@ def processAlgorithm(self, progress):

request = QgsFeatureRequest()

random.seed()

while nIterations < maxIterations and nPoints < pointCount:
rx = bbox.xMinimum() + bbox.width() * random.random()
ry = bbox.yMinimum() + bbox.height() * random.random()
@@ -80,10 +80,9 @@ def processAlgorithm(self, progress):
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
fields, QGis.WKBPoint, layer.dataProvider().crs())


request = QgsFeatureRequest()

da = QgsDistanceArea()

features = vector.features(layer)
for current, f in enumerate(features):
fGeom = QgsGeometry(f.geometry())
@@ -101,6 +100,8 @@ def processAlgorithm(self, progress):
maxIterations = pointCount * 200
total = 100.0 / pointCount

random.seed()

while nIterations < maxIterations and nPoints < pointCount:
rx = bbox.xMinimum() + bbox.width() * random.random()
ry = bbox.yMinimum() + bbox.height() * random.random()
@@ -82,8 +82,8 @@ def processAlgorithm(self, progress):
fields, QGis.WKBPoint, layer.dataProvider().crs())

request = QgsFeatureRequest()

da = QgsDistanceArea()

features = vector.features(layer)
for current, f in enumerate(features):
fGeom = QgsGeometry(f.geometry())
@@ -101,6 +101,8 @@ def processAlgorithm(self, progress):
maxIterations = pointCount * 200
total = 100.0 / pointCount

random.seed()

while nIterations < maxIterations and nPoints < pointCount:
rx = bbox.xMinimum() + bbox.width() * random.random()
ry = bbox.yMinimum() + bbox.height() * random.random()

0 comments on commit 9b4b1df

Please sign in to comment.