Skip to content

Commit

Permalink
Document random(QQ)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-torrance committed Sep 21, 2024
1 parent 6f5e7ef commit 428b1ea
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/random-doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,29 @@ Node
SeeAlso
setRandomSeed

Node
Key
(random, QQ)
Headline
get a random rational number
Usage
random x
Inputs
x:QQ
Height => ZZ
Outputs
:QQ -- randomly chosen from the interval $[0, x]$
Description
Text
A random number is chosen from the uniform distribution on the interval
$[0, x]$ and then rounded (using the @wikipedia "Farey sequence"@) to the
nearest rational number with denominator bounded by the @CODE "Height"@
option.
Example
apply(10, i -> random(7_QQ, Height => 5))
SeeAlso
setRandomSeed

Node
Key
(random, Type)
Expand Down

0 comments on commit 428b1ea

Please sign in to comment.