Random - Maple Help

LinearAlgebra[Modular]

 Random
 create a new mod m Matrix or Vector containing random values

 Calling Sequence Random(m, nrow, ncol, dtype, order)

Parameters

 m - modulus nrow - number of rows in output object ncol - number of columns in output object dtype - datatype of output object order - (optional) ordering of output object

Description

 • The Random function creates a new mod m Matrix or Vector of the specified type and dimensions, assigning to each entry a uniformly distributed random value in the range $0..m-1$.
 A row Vector can be obtained by setting $\mathrm{nrow}=0$, and a column Vector by setting $\mathrm{ncol}=0$. If $0<\mathrm{nrow}$ and $0<\mathrm{ncol}$, a Matrix is produced. If $\mathrm{nrow}=0$ and $\mathrm{ncol}=0$, an error results.
 • The allowable datatypes are hardware integer (dtype=integer[4]/integer[8] or integer[]), hardware float (dtype=float[8]), or Maple integer (dtype=integer). If specified, order can be C_order or Fortran_order. If order is not specified, C_order is used.
 • This command is part of the LinearAlgebra[Modular] package, so it can be used in the form Random(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][Random](..).

Examples

 > $\mathrm{with}\left({\mathrm{LinearAlgebra}}_{\mathrm{Modular}}\right):$
 > $\mathrm{A1}≔\mathrm{Random}\left(31,5,4,{\mathrm{integer}}_{[]}\right)$
 ${\mathrm{A1}}{≔}\left[\begin{array}{cccc}{7}& {9}& {10}& {8}\\ {30}& {24}& {27}& {11}\\ {29}& {5}& {10}& {21}\\ {5}& {16}& {13}& {22}\\ {30}& {23}& {14}& {20}\end{array}\right]$ (1)
 > $\mathrm{A2}≔\mathrm{Random}\left(31,20,30,{\mathrm{float}}_{8},\mathrm{Fortran_order}\right)$
 > ${\mathrm{A2}}_{1..3,1..3}$
 $\left[\begin{array}{ccc}{4.}& {0.}& {3.}\\ {9.}& {4.}& {21.}\\ {11.}& {26.}& {3.}\end{array}\right]$ (2)
 > $\mathrm{A3}≔\mathrm{Random}\left(31,3,0,{\mathrm{integer}}_{[]}\right)$
 ${\mathrm{A3}}{≔}\left[\begin{array}{c}{28}\\ {29}\\ {22}\end{array}\right]$ (3)
 > $\mathrm{whattype}\left(\mathrm{A3}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{column}}}$ (4)
 > $\mathrm{A4}≔\mathrm{Random}\left(31,0,5,{\mathrm{float}}_{8}\right)$
 ${\mathrm{A4}}{≔}\left[\begin{array}{ccccc}{12.}& {27.}& {10.}& {14.}& {17.}\end{array}\right]$ (5)
 > $\mathrm{whattype}\left(\mathrm{A4}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{row}}}$ (6)