diff options
author | Gabriel Dos Reis <gdr@axiomatics.org> | 2015-12-31 14:56:12 -0800 |
---|---|---|
committer | Gabriel Dos Reis <gdr@axiomatics.org> | 2015-12-31 14:56:12 -0800 |
commit | f51aee83708673ef9941174951bec9aee80cb03c (patch) | |
tree | 4d8cfccd653dfa09819234bc61a8775091e4f1e6 /src/algebra/gpgcd.spad.pamphlet | |
parent | 039d244dbef31e4ca6d34d2cf42b58b41a572884 (diff) | |
download | open-axiom-f51aee83708673ef9941174951bec9aee80cb03c.tar.gz |
Avoid modulus bias in 'random()' usage.
Diffstat (limited to 'src/algebra/gpgcd.spad.pamphlet')
-rw-r--r-- | src/algebra/gpgcd.spad.pamphlet | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/algebra/gpgcd.spad.pamphlet b/src/algebra/gpgcd.spad.pamphlet index c247b8cc..d6bd096d 100644 --- a/src/algebra/gpgcd.spad.pamphlet +++ b/src/algebra/gpgcd.spad.pamphlet @@ -153,7 +153,7 @@ GeneralPolynomialGcdPackage(E,OV,R,P):C == T where randomCount:=init() randomCount else - randomR() == (random()$Integer rem 100)::R + randomR() == (random(100)$Integer)::R ---- JHD's local functions --- gcdSameVariables(p1:SUPP,p2:SUPP,lv:List OV) == -- two non-trivial primitive (or, at least, we don't care @@ -299,7 +299,7 @@ GeneralPolynomialGcdPackage(E,OV,R,P):C == T where --JHD range:I:=8 --JHD for i in 1.. repeat --JHD range:=2*range ---JHD lval:=[(random()$I rem (2*range) - range)::R for i in 1..nvr] +--JHD lval:=[(random(2*range)$I - range)::R for i in 1..nvr] --JHD uf1:SUPR:=univariate eval(p1,lvr,lval) --JHD degree uf1 ~= d1 => "new point" --JHD uf2:SUPR:=univariate eval(p2,lvr,lval) @@ -337,7 +337,7 @@ GeneralPolynomialGcdPackage(E,OV,R,P):C == T where --JHD ltry:List List R:=[] --JHD while true repeat --JHD range:=2*range ---JHD lval:=[(random()$I rem (2*range) -range)::R for i in 1..nvr] +--JHD lval:=[(random(2*range)$I -range)::R for i in 1..nvr] --JHD member?(lval,ltry) => "new point" --JHD ltry:=cons(lval,ltry) --JHD uf:=univariate eval(f,lvr,lval) |