diff --git a/M2/Macaulay2/m2/reals.m2 b/M2/Macaulay2/m2/reals.m2 index cf43d059498..eb5d9b2c9d6 100644 --- a/M2/Macaulay2/m2/reals.m2 +++ b/M2/Macaulay2/m2/reals.m2 @@ -252,6 +252,19 @@ random RingFamily := opts -> R -> random(default R,opts) random QQ := QQ => opts -> hi -> random(0_QQ, hi, opts) random(QQ, QQ) := QQ => opts -> (lo, hi) -> rawFareyApproximation( random(numeric lo, random numeric hi), opts.Height) +random(ZZ, QQ) := QQ => opts -> (lo, hi) -> random(lo_QQ, hi, opts) +random(QQ, ZZ) := QQ => opts -> (lo, hi) -> random(lo, hi_QQ, opts) + +random CC := CC => opts -> hi -> toCC( + random realPart hi, random imaginaryPart hi) +random(CC, CC) := CC => opts -> (lo, hi) -> toCC( + random(realPart lo, realPart hi), + random(imaginaryPart lo, imaginaryPart hi)) +random(RR, CC) := CC => opts -> (lo, hi) -> random(toCC lo, hi) +random(CC, RR) := CC => opts -> (lo, hi) -> random(lo, toCC hi) + +random Number := opts -> hi -> random numeric hi +random(Number, Number) := opts -> (lo, hi) -> random(numeric lo, numeric hi) -- algebraic operations and functions