In the discussion a few weeks ago:
https://groups.google.com/d/topic/fricas-devel/-tRRqGIXXiE/discussion
    [BUG] r1976: Remove argumentless 'random'; pfo.spad

I take another look at the discussion and r1976, and
I'm sure the following patch will restore the code logic
before r1976; this is not an improvement but at least
fixes some regressions introduced in FriCAS 1.3.0.

Also by replacing "random(nn)" with "1+random(nn)",
I think it decreases the possibility of getting "division by zero"
error.

diff --git a/src/algebra/pfo.spad b/src/algebra/pfo.spad
index 816fe220..fc3dff35 100644
--- a/src/algebra/pfo.spad
+++ b/src/algebra/pfo.spad
@@ -235,7 +235,7 @@
     K2Z : K -> F

     redmap := table()$AssociationList(K, Z)
-    nn : Integer := 1
+    nn : Integer := 10^6

     newReduc(n) ==
       nn := n
@@ -254,7 +254,7 @@
     K2Z k ==
       has?(operator k, ALGOP) => error "Cannot reduce constant field"
       (u := search(k, redmap)) case "failed" =>
-                                      setelt!(redmap, k, random(nn)$Z)::F
+                                      setelt!(redmap, k, 1+random(nn)$Z)::F
       u::Z::F

 )abbrev package PFO PointsOfFiniteOrder

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to