@@ -345,7 +345,7 @@ chooseRandomNonzeroSubmatrix(ZZ, Matrix) := opts -> (n1, M1) -> (
345345 -- curList = flatten entries curM1;
346346 entryList = entries transpose matrix nonzeroEntries(curM1);
347347 if #entryList == 0 then return null ;
348- curEntry = entryList#( random (# entryList)) ;
348+ curEntry = random entryList;
349349 -- print (curList#curMax);
350350 curRow = curEntry#0;
351351 curCol = curEntry#1;
@@ -535,7 +535,7 @@ chooseMinorSmallestDegree(ZZ, MutableMatrix) := o -> (n1, M1) -> (
535535randomMaxPosition = method (Options =>{});
536536randomMaxPosition(List ) := o -> (L1) -> (
537537 newList := apply (#L1, i -> {L1#i, random ((#L1)^2), i});
538- newList2 := random (newList);
538+ newList2 := shuffle (newList);
539539 j := maxPosition (newList2);
540540 return ((newList2#j)#2);
541541);
@@ -544,7 +544,7 @@ randomMaxPosition(List) := o -> (L1) -> (
544544randomMinPosition = method (Options =>{});
545545randomMinPosition(List ) := o -> (L1) -> (
546546 newList := apply (#L1, i -> {L1#i, random ((#L1)^2), i});
547- newList2 := random (newList);
547+ newList2 := shuffle (newList);
548548 j := minPosition (newList2);
549549 return ((newList2#j)#2);
550550);
@@ -553,7 +553,7 @@ randomMinPosition(List) := o -> (L1) -> (
553553randomMinPositions = method (Options =>{});
554554randomMinPositions(ZZ , List ) := o -> (n1, L1) -> (
555555 newList := apply (#L1, i -> {L1#i, random ((#L1)^2), i});
556- newList2 := random (newList);
556+ newList2 := shuffle (newList);
557557 newList3 := sort (newList2);
558558 return apply (take (n1, newList3), z -> z#0);
559559);
@@ -622,10 +622,8 @@ chooseRandomSubmatrix = method(Options=>{});
622622
623623chooseRandomSubmatrix(ZZ , Matrix ) := opts -> (n1, M1) ->
624624(
625- rowL := random (toList (0..(numRows M1 - 1 )));
626- colL := random (toList (0..(numColumns M1 - 1 )));
627- rowL = sort take (rowL, n1);
628- colL = take (colL, n1);
625+ rowL := randomSubset (numRows M1, n1);
626+ colL := take (shuffle toList (0..<numColumns M1), n1);
629627 return {rowL, colL};
630628 )
631629
@@ -648,7 +646,7 @@ reorderPolynomialRing(Symbol, Ring) := opts-> (myOrder, R1) -> (
648646 if (debugLevel > 0 ) then print " reorderPolynomialRing: it is a polynomialRing" ;
649647 coeff := coefficientRing R1;
650648 genList := generators R1;
651- newGenList := random (genList);
649+ newGenList := shuffle (genList);
652650 return coeff[newGenList, MonomialOrder => myOrder];)
653651 else (return R1);
654652);
0 commit comments