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 21b33c7 commit 2df5795Copy full SHA for 2df5795
deepxde/geometry/geometry_2d.py
@@ -431,13 +431,12 @@ def boundary_normal(self, x):
431
return np.array([0, 0])
432
433
def random_points(self, n, random="pseudo"):
434
- x = []
+ x = np.empty((0, 2))
435
vbbox = self.bbox[1] - self.bbox[0]
436
while len(x) < n:
437
- x_new = np.random.rand(1, 2) * vbbox + self.bbox[0]
438
- if self.inside(x_new):
439
- x.append(x_new)
440
- return np.vstack(x)
+ x_new = np.random.rand(n, 2) * vbbox + self.bbox[0]
+ x = np.vstack((x, x_new[self.inside(x_new)]))
+ return x[:n]
441
442
def uniform_boundary_points(self, n):
443
density = n / self.perimeter
0 commit comments