diff --git a/overviewer_core/quadtree.py b/overviewer_core/quadtree.py index 83c0629..2e7f1bb 100644 --- a/overviewer_core/quadtree.py +++ b/overviewer_core/quadtree.py @@ -439,7 +439,7 @@ class QuadtreeGen(object): break # stochastic render check - if not needs_rerender and self.rerender_probability > 0.0 and random.uniform(0, 1) < self.rerender_probability: + if not needs_rerender and self.rerender_probability > 0.0 and random.random() < self.rerender_probability: needs_rerender = True # if after all that, we don't need a rerender, return @@ -538,6 +538,17 @@ class QuadtreeGen(object): dirty.set_dirty(tile.path) continue + # Stochastic check. Since we're scanning by chunks and not + # by tiles, and the tiles get checked multiple times for + # each chunk, this is only an approximation. The given + # probability is for a particular tile that needs + # rendering, but since a tile gets touched up to 32 times + # (once for each chunk in it), divide the probability by + # 32. + if self.rerender_probability and self.rerender_probability/32 > random.random(): + dirty.set_dirty(tile.path) + continue + # Check if this tile has already been marked dirty. If so, # no need to do any of the below. if dirty.query_path(tile.path):