RandomInstance

RandomInstance[expr]

finds a random instance of an expression such as a geometric scene or biomolecular sequence.

RandomInstance[expr,n]

finds n instances.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Represent a symbolic geometric scene containing a triangle with points a, b, c and a 30° angle:

RandomInstance finds a particular instance of the scene:

Rules giving coordinates for the points have been filled in:

Find multiple instances of the scene:

Find an arbitrary DNA sequence of length 12:

Scope  (1)

Generate three random DNA sequences of length 50:

Sample specific sequences specified by a degenerate sequence:

Options  (1)

RandomSeeding  (1)

By default, RandomInstance finds different solutions each time:

Use RandomSeedingseed to use an explicit integer or string as a seed:

Applications  (1)

Decompose a polygon into similar triangles:

Properties & Relations  (1)

Use RandomInstance to find random polygons:

This can also be done with RandomPolygon:

Wolfram Research (2019), RandomInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomInstance.html (updated 2020).

Text

Wolfram Research (2019), RandomInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomInstance.html (updated 2020).

CMS

Wolfram Language. 2019. "RandomInstance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/RandomInstance.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_randominstance, author="Wolfram Research", title="{RandomInstance}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/RandomInstance.html}", note=[Accessed: 18-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_randominstance, organization={Wolfram Research}, title={RandomInstance}, year={2020}, url={https://reference.wolfram.com/language/ref/RandomInstance.html}, note=[Accessed: 18-December-2024 ]}