Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » mutable matrices » randomMutableMatrix(ZZ,ZZ,RR,ZZ)
next | previous | forward | backward | up | index | toc

# randomMutableMatrix(ZZ,ZZ,RR,ZZ) -- a random mutable matrix of integers

- Function: randomMutableMatrix
- Usage:
    `randomMutableMatrix(nrows,ncols,zerof,max)`
- Inputs:
  - nrows, an integer
  - ncols, an integer
  - zerof, a real number, between 0 and 1
  - max, an integer
- Optional inputs:
  - Dense => ..., default value false, whether the encoding of the matrix should be dense or not: see MutableMatrix
- Outputs:
  - a mutable matrix, a random mutable nrows by ncols matrix of integers. The absolute value of the entries is less than max, and the frequency of entries equal to zero is given by zerof.

## Description

This function has been superseded by fillMatrix, which works over more rings, is much faster for large matrices, and is more flexible.

    i1 : randomMutableMatrix(10,15,.9,100)

    o1 = | 0 0   0  0   0  0 0   0 0  0 49  0   0   0  0  |
         | 0 0   0  0   14 0 0   0 0  0 0   0   0   0  0  |
         | 0 0   0  0   0  0 0   0 0  0 0   -12 -17 0  0  |
         | 0 0   0  0   0  0 1   0 0  0 0   0   0   0  0  |
         | 0 -87 80 0   0  0 0   0 0  0 -34 0   0   88 0  |
         | 1 0   0  0   0  0 -70 0 0  0 0   0   0   0  0  |
         | 0 0   0  100 0  0 0   0 0  0 0   0   0   0  0  |
         | 0 0   0  0   0  0 82  0 0  0 0   0   0   0  72 |
         | 0 0   0  0   0  0 0   0 48 0 0   0   0   99 0  |
         | 0 0   0  0   0  0 0   0 0  0 0   0   0   0  0  |

    o1 : MutableMatrix

## See also

- mutableMatrix -- make a mutable matrix
- fillMatrix -- fill a mutable matrix with random numbers
- setRandomSeed -- set starting point for random number generator
- random -- get a random object

## Ways to use this method:

- randomMutableMatrix(ZZ,ZZ,RR,ZZ) -- a random mutable matrix of integers

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