cmatrix.rand_perm

cmatrix.rand_perm()

Generate a random permutation matrix size x size

Parameters

Type

Description

size

int

The size of the square matrix

Returns
1/0 Matrix

A random-generated permutation matrix

See also

set_ij()

Examples

>>> m=rand_perm(4)
>>> print(m)
| +0.000 | +0.000 | +0.000 | +1.000 |
| +0.000 | +1.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +1.000 | +0.000 |
| +1.000 | +0.000 | +0.000 | +0.000 |
printed