WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

RandomPoint [reg]

gives a pseudorandom point uniformly distributed in the region reg.

RandomPoint [reg,n]

gives a list of n pseudorandom points uniformly distributed in the region reg.

RandomPoint [reg,{n1,n2,}]

gives an n1×n2× array of pseudorandom points.

RandomPoint [reg,,{{xmin,xmax},}]

restricts to the bounds .

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Basic Uses  
Special Regions  
Formula Regions  
Mesh Regions  
Derived Regions  
Applications  
2D Galleries  
3D Galleries  
Monte Carlo Methods  
Region Relations  
Approximate Convexity  
Nearest and Farthest Points  
Properties & Relations  
See Also
Related Guides
History
Cite this Page

RandomPoint [reg]

gives a pseudorandom point uniformly distributed in the region reg.

RandomPoint [reg,n]

gives a list of n pseudorandom points uniformly distributed in the region reg.

RandomPoint [reg,{n1,n2,}]

gives an n1×n2× array of pseudorandom points.

RandomPoint [reg,,{{xmin,xmax},}]

restricts to the bounds .

Details and Options

Examples

open all close all

Basic Examples  (3)

Generate a list of points in a unit disk:

Generate multiple lists of points on a unit circle:

Generate a list of points in a standard cylinder:

Scope  (22)

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)

Regions in :

Regions in :

Visualize region points in :

Regions in :

Visualize region points in :

Regions in :

Formula Regions  (3)

Implicit regions:

Visualize region points in :

Parametric regions:

Mesh Regions  (4)

MeshRegion in 2D:

In 3D:

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:

TransformedRegion :

RegionBoundary :

Applications  (24)

2D Galleries  (9)

Generate a list of uniform random unit vectors in :

Visualize a parametric heart curve:

Parametric butterfly curve:

Implicit trifolium curve:

Graphics scene:

Implicit Lissajous region:

Mixed implicit and parametric region:

Country polygon:

Text primitive:

3D Galleries  (6)

Generate a list of uniform random unit vectors in :

Parametric helix curve:

Implicit Viviani's curve:

Parametric torus surface:

Implicit eight solid:

Graphics3D scene:

Monte Carlo Methods  (2)

Perform Monte Carlo integration to estimate the area of a unit disk:

Get the region bounds:

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 bounding area:

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:

Find the farthest point on a region from a given point:

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:

However, instances are not uniform:

Wolfram Research (2015), RandomPoint, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPoint.html.

Text

Wolfram Research (2015), RandomPoint, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomPoint.html.

CMS

Wolfram Language. 2015. "RandomPoint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomPoint.html.

APA

Wolfram Language. (2015). RandomPoint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomPoint.html

BibTeX

@misc{reference.wolfram_2025_randompoint, author="Wolfram Research", title="{RandomPoint}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/RandomPoint.html}", note=[Accessed: 17-November-2025]}

BibLaTeX

@online{reference.wolfram_2025_randompoint, organization={Wolfram Research}, title={RandomPoint}, year={2015}, url={https://reference.wolfram.com/language/ref/RandomPoint.html}, note=[Accessed: 17-November-2025]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /