aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/divisor.spad.pamphlet
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@axiomatics.org>2015-12-31 14:56:12 -0800
committerGabriel Dos Reis <gdr@axiomatics.org>2015-12-31 14:56:12 -0800
commitf51aee83708673ef9941174951bec9aee80cb03c (patch)
tree4d8cfccd653dfa09819234bc61a8775091e4f1e6 /src/algebra/divisor.spad.pamphlet
parent039d244dbef31e4ca6d34d2cf42b58b41a572884 (diff)
downloadopen-axiom-f51aee83708673ef9941174951bec9aee80cb03c.tar.gz
Avoid modulus bias in 'random()' usage.
Diffstat (limited to 'src/algebra/divisor.spad.pamphlet')
-rw-r--r--src/algebra/divisor.spad.pamphlet4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/algebra/divisor.spad.pamphlet b/src/algebra/divisor.spad.pamphlet
index f8c15f86..162e67aa 100644
--- a/src/algebra/divisor.spad.pamphlet
+++ b/src/algebra/divisor.spad.pamphlet
@@ -164,7 +164,7 @@ FractionalIdeal(R, F, UP, A): Exports == Implementation where
+/[random()$F * qelt(v, j) for j in minIndex v .. maxIndex v]
else
randomLC(m, v) ==
- +/[(random()$Integer rem m::Integer) * qelt(v, j)
+ +/[random(m)$Integer * qelt(v, j)
for j in minIndex v .. maxIndex v]
minimize i ==
@@ -313,7 +313,7 @@ ModularHermitianRowReduction(R): Exports == Implementation where
lr := [i for i in minRowIndex x .. maxRowIndex x]$List(Integer)
for i in 1..(n := binomial(nr, nc)) repeat
(d := determinant x(enumerateBinomial(lr, nc, i), lc)) ~= 0 =>
- j := i + 1 + (random()$Z rem (n - i))
+ j := i + 1 + random(n - i)$Z
return gcd(d, determinant x(enumerateBinomial(lr, nc, j), lc))
0