We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d523bf commit a70126bCopy full SHA for a70126b
1 file changed
Python/random-point-in-non-overlapping-rectangles.py
@@ -60,8 +60,7 @@ def pick(self):
60
target = random.randint(0, self.__prefix_sum[-1]-1)
61
left = bisect.bisect_right(self.__prefix_sum, target)
62
rect = self.__rects[left]
63
- width = rect[2]-rect[0]+1
64
- height = rect[3]-rect[1]+1
+ width, height = rect[2]-rect[0]+1, rect[3]-rect[1]+1
65
base = self.__prefix_sum[left]-width*height
66
return [rect[0]+(target-base)%width, rect[1]+(target-base)//width]
67
0 commit comments