Skip to content

Commit

Permalink
Document random(QQ) and random(QQ, QQ)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-torrance committed Sep 20, 2024
1 parent 15f1394 commit 95e64e3
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/random-doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ Node
Key
(random, ZZ, ZZ)
(random, ZZ)
(random, QQ, QQ)
(random, QQ)
(random, RR, RR)
(random, RR)
Headline
get a random integer or real number
get a random integer, rational number, or real number
Synopsis
Usage
random(low, high)
random high
Inputs
low:{ZZ,RR}
high:{ZZ,RR}
low:{ZZ,QQ,RR}
high:{ZZ,QQ,RR}
Outputs
:ZZ
a random integer or real number of the same @TO precision@
:{ZZ,QQ,RR}
a random integer, rational number, or real number of the same
@TO precision@
Description
Text
If only @TT "high"@ is given, the output will be in the range @TT "[0, high)"@.
Expand All @@ -58,6 +61,12 @@ Node
tally apply(100, i -> random(10,15))
random(10.,20.)
random(10p100,20p100)
Text
If the inputs are rational, then the output will be rounded to the
nearest rational number with denominator bounded by the number given
in the @TO Height@ option.
Example
apply(10, i -> random(-5_QQ, 5_QQ, Height => 5))
SeeAlso
setRandomSeed

Expand Down

0 comments on commit 95e64e3

Please sign in to comment.