[Aimmath-commit] AIM/WEB-INF/maple Random.mpl,1.1.1.1.2.1,1.1.1.1.2.2
Brought to you by:
gustav_delius,
npstrick
|
From: <gr...@us...> - 2003-07-09 09:29:27
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple
In directory sc8-pr-cvs1:/tmp/cvs-serv28701
Modified Files:
Tag: develop_2_1
Random.mpl
Log Message:
Added function: randnotfrom - GG
Index: Random.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/Random.mpl,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -d -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** Random.mpl 8 Jul 2003 06:21:33 -0000 1.1.1.1.2.1
--- Random.mpl 9 Jul 2003 09:29:24 -0000 1.1.1.1.2.2
***************
*** 257,259 ****
--- 257,276 ----
);
+ `Package/Assign`(
+ randnotfrom::integer,
+ "Return a random integer in a range or list not in @lis1@ that is
+ coprime to each element of @lis2@ (@lis2@ is optional; if omitted
+ it is taken to be the empty set)",
+ proc(range::{integer,range(integer),list}, lis1::{list,set},
+ lis2::{list(integer),set(integer)})
+ local n, lis2_;
+ n := Rand(range);
+ lis2_ := `if`(evalb(nargs = 2), {}, lis2);
+ while member(n, lis1) or Exists(lis2_, x -> igcd(n, x) <> 1) do
+ n := Rand(range);
+ od;
+ n;
+ end
+ ):
+
EndPackage():
|