up previous next
randomize the coefficients of a given polynomial
Randomized(F: RINGELEM): RINGELEM
Randomized(F: INT): INT |
***** NOT YET IMPLEMENTED: use random *****
This function with a polynomial argument returns a polynomial
obtained by replacing the coefficients of F with randomly generated
coefficients. The original polynomial, F, is unaffected. With an
integer argument, it returns a random integer.
NOTE: It is possible that some coefficients will be replaced by
zeroes, i.e., some terms from the original polynomial may disappear in
the result.
The similar function
randomize
performs the same operation,
but returns NULL and modifies the argument.
NOTE: every time you restart CoCoA the sequence of random numbers will
be the same (as in other programming languages). If you want total
randomness read
seed
.
Use R ::= QQ[x];
F := 1 + x + x^2;
Randomized(F);
-2917104644x^2 + 3623608766x - 2302822308
-------------------------------
F;
x^2 + x + 1
-------------------------------
Randomized(23);
-3997312402
-------------------------------
Use R ::= ZZ/(7)[x,y];
Randomized(x^2 + 3x - 5);
3x^2 + 2x - 2
-------------------------------
|