Function Repository Resource:

RandomRealPoint

Source Notebook

Randomly choose a point within a specified domain

Contributed by: Arnoud Buzing

ResourceFunction["RandomRealPoint"][{range1,range2,}]

generates a random point in the domain defined by the ranges.

ResourceFunction["RandomRealPoint"][ranges,n]

generates n random points on the domain.

ResourceFunction["RandomRealPoint"][ranges,{n1,n2,n3}]

gives an n1× n2×… array of random points.

Details and Options

RandomRealPoint uses RandomReal to generate points with a uniform distribution.
Possible specifications of rangei are:
xmax between zero and xmax
{xmin,xmax} in range xmin to xmax

Examples

Basic Examples (3) 

Find a point within a domain:

In[1]:=
ResourceFunction["RandomRealPoint"][{100, 10, 1}]
Out[1]=

Find many within a four-dimensional domain:

In[2]:=
ResourceFunction["RandomRealPoint"][{20, 10, 10, 100}, 6]
Out[2]=

Create an array of random two-dimensional points in the specified domain:

In[3]:=
array = ResourceFunction[
  "RandomRealPoint"][{{-100, 100}, {500, 1000}}, {2, 5}]
Out[3]=

Plot the points on a plane:

In[4]:=
ListPlot[array]
Out[4]=

Scope (2) 

Create an array of random three-dimensional points:

In[5]:=
array = ResourceFunction["RandomRealPoint"][{100, 10, 1}, {2, 5}]
Out[5]=

Plot the points as surfaces:

In[6]:=
ListPlot3D[array]
Out[6]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.0 – 11 October 2018

License Information