rand

MapdlMath.rand(nrow, ncol=None, dtype=<class 'numpy.float64'>)

Create a vector or matrix containing all random values

Parameters
nrowint

Number of rows.

ncolint, optional

Number of columns. If specified, returns a matrix.

dtypenp.dtype, optional

Datatype of the vector. Must be either np.int32, np.int64, or np.double.

Returns
AnsVec or AnsMat

APDLMath vector or matrix depending on if “ncol” is specified.

Examples

Create a random vector.

>>> from ansys.mapdl.core import launch_mapdl
>>> mapdl = launch_mapdl()
>>> mm = mapdl.math()
>>> vec = mm.rand(10)

Create a random matrix.

>>> mat = mm.rand(10, 10)