Macaulay2 » Documentation
Packages » Macaulay2Doc » combinatorics » random » random(List,Module)
next | previous | forward | backward | up | index | toc

# random(List,Module) -- get a random vector in the module

- Function: random
- Usage:
    `v = random(d, M)`
    `v = random M`
- Inputs:
  - d, an integer or a list, a degree or degree vector, assumed to be zero if omitted;
  - M, a module,
- Optional inputs:
  - Density => ..., default value 1, get a random map of module
  - Height => ..., default value 10, get a random homogeneous element from a graded ring
  - MaximalRank => ..., default value false, get a random map of module
  - UpperTriangular => ..., default value false, get a random map of module
- Outputs:
  - v, a vector,

## Description

    i1 : R = ZZ/7[x,y]

    o1 = R

    o1 : PolynomialRing

    i2 : E = End R^{-1,1}

          4
    o2 = R

    o2 : R-module, free, degrees {0, -2, 2, 0}

    i3 : h = homomorphism random E

    o3 = {1}  | 3      0 |
         {-1} | x2+3xy 0 |

                 2      2
    o3 : Matrix R  <-- R

    i4 : h = homomorphism random(0, E)

    o4 = {1}  | 2            0 |
         {-1} | -3x2+3xy+3y2 3 |

                 2      2
    o4 : Matrix R  <-- R

    i5 : h = homomorphism random(1, E)

    o5 = {1}  | 0            0      |
         {-1} | 3x3-2x2y-2y3 -2x-2y |

                 2      2
    o5 : Matrix R  <-- R

    i6 : h = homomorphism random(-1, E)

    o6 = {1}  | 0     0 |
         {-1} | 2x+3y 0 |

                 2      2
    o6 : Matrix R  <-- R

    i7 : h = homomorphism random(-2, E)

    o7 = {1}  | 0  0 |
         {-1} | -1 0 |

                 2      2
    o7 : Matrix R  <-- R

## See also

- Hom(Module,Module) -- module of homomorphisms
- random(Module,Module) -- get a random map of module
- setRandomSeed -- set starting point for random number generator

## Ways to use this method:

- random(List,Module) -- get a random vector in the module
- `random(Module)`
- `random(ZZ,Module)`

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/random-doc.m2:262:0.