WLJS LogoWLJS Notebook

RandomInstance

RandomInstance[expr] finds a random instance of an expression such as a geometric scene or biomolecular sequence.

  • RandomInstance[expr, n] finds n instances.

Examples

Generate a random instance of a geometric scene:

RandomInstance[GeometricScene[{a, b, c}, {Triangle[{a, b, c}]}]]

Get multiple random instances:

RandomInstance[GeometricScene[{a, b, c}, {Triangle[{a, b, c}]}], 3]

Random DNA sequence matching a pattern:

RandomInstance[BioSequence["DNA", "ATCG" ~~ ___ ~~ "GCTA"]]

Please visit the official Wolfram Language Reference for more details.

On this page