gives a pseudorandom point uniformly distributed in the region reg.
gives a list of n pseudorandom points uniformly distributed in the region reg.
gives an n1× n2×… array of pseudorandom points.
restricts to the bounds .
Details and Options
- RandomPoint can generate random points for any RegionQ region that is also ConstantRegionQ.
- RandomPoint will generate points uniformly in the region reg.
- RandomPoint gives a different sequence of pseudorandom numbers whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
- With the setting WorkingPrecision->p, random numbers of precision p will be generated.
Examplesopen allclose all
Basic Examples (3)
Basic Uses (5)
Generate a point in a unit ball region:
Generate a list of points for a triangle region:
Generate multiple lists of points for a unit disk region:
Generate points on an unbounded region within given bounds:
The random points are restricted to :
Generate points on an unbounded region within given bounds in :
Special Regions (6)
Mesh Regions (4)
MeshRegion in 2D:
BoundaryMeshRegion in 2D:
BoundaryMeshRegion in 3D:
Derived Regions (4)
RegionIntersection of two regions:
RegionUnion of mixed-dimensional regions:
Points are generated for the maximum dimensional component:
2D Galleries (9)
3D Galleries (6)
Generate a list of uniform random unit vectors in :
Monte Carlo Methods (2)
Perform Monte Carlo integration to estimate the area of a unit disk:
Uniformly sample over the bounding box of the region:
Count the number of samples inside the region:
Get the ratio of samples inside the region to the total number of sample points:
Get the approximate area of the region:
Visualize the Minkowski sum (orange) of two regions:
Sum of points from two regions gives points of the Minkowski sum region:
Region Relations (3)
Compute an approximate bounding box for a region from random samples. The resulting bounding will be a subset of the true bounding box:
Compare with its region bounds:
Show that a region is not a subset of another:
Check if any point from a set of random points in the disk are not in the square:
Visualize the random points in the disk that are not in the square:
Determine that two regions are not equal:
Check if any point from a set of random points in the disk is not in the square, or vice versa:
Approximate Convexity (2)
Determine that a region is not convex by sampling, and show that there is a convex combination of the samples that is not a member of the original region:
Generate pairwise convex combinations of random points within the region:
If a point on a pairwise convex combination is not in the region, then the region is not convex:
Alternatively generate and test points in a convex hull of points:
Compute the approximate convex hull of a region from random points within the region:
Nearest and Farthest Points (2)
Find an approximate nearest point in a region by sampling the region and computing the nearest point to the samples. This gives an upper bound for the distance to the region:
Find the nearest point from a set of random points in the region:
Compare the resulting distance to the true minimum distance to the region:
Define a function that finds an approximate farthest point in a region:
Properties & Relations (6)
RandomPoint will generate points with uniform density:
Choosing random coordinate points from a region of points:
Corresponds to RandomChoice of coordinate points:
Choosing random points from a Cuboid region:
Corresponds to RandomVariate of a UniformDistribution:
Choosing random points from a Disk region:
Corresponds to RandomVariate of a WignerSemicircleDistribution:
Choosing random coordinate points from a Triangle region:
Corresponds to RandomVariate of a TriangularDistribution:
FindInstance can generate exact instances for special and formula regions:
Wolfram Research (2015), RandomPoint, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPoint.html.
Wolfram Language. 2015. "RandomPoint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomPoint.html.
Wolfram Language. (2015). RandomPoint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomPoint.html