Macaulay2 » Documentation
Packages » Macaulay2Doc » combinatorics » random » random(QQ)
next | previous | forward | backward | up | index | toc

random(QQ) -- get a random rational number

Description

A random number is chosen from the uniform distribution on the interval $[0, x]$ and then rounded (using the Farey sequence) to the nearest rational number with denominator bounded by the Height option.

i1 : apply(10, i -> random(7_QQ, Height => 5))

      25  19     22  1     25  8  13  27
o1 = {--, --, 2, --, -, 5, --, -, --, --}
       4   4      5  5      4  5   4   5

o1 : List

See also

Ways to use this method:


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/random-doc.m2:262:0.