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}\left[\mathrm{Modular}\right]\right):$
 > $\mathrm{A1}≔\mathrm{Random}\left(31,5,4,\mathrm{integer}\left[\right]\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}\left[8\right],\mathrm{Fortran_order}\right)$
 ${\mathrm{A2}}{≔}\begin{array}{c}\left[\begin{array}{ccccccccccc}{4.}& {0.}& {3.}& {4.}& {19.}& {12.}& {23.}& {5.}& {29.}& {29.}& {\dots }\\ {9.}& {4.}& {21.}& {16.}& {0.}& {21.}& {3.}& {24.}& {13.}& {8.}& {\dots }\\ {11.}& {26.}& {3.}& {27.}& {5.}& {3.}& {2.}& {15.}& {19.}& {0.}& {\dots }\\ {27.}& {4.}& {21.}& {23.}& {23.}& {5.}& {2.}& {16.}& {0.}& {21.}& {\dots }\\ {9.}& {19.}& {6.}& {4.}& {14.}& {2.}& {28.}& {30.}& {5.}& {30.}& {\dots }\\ {8.}& {9.}& {1.}& {26.}& {5.}& {18.}& {27.}& {12.}& {6.}& {12.}& {\dots }\\ {27.}& {26.}& {5.}& {18.}& {15.}& {1.}& {16.}& {21.}& {17.}& {7.}& {\dots }\\ {19.}& {18.}& {14.}& {30.}& {8.}& {14.}& {18.}& {29.}& {29.}& {6.}& {\dots }\\ {17.}& {30.}& {27.}& {20.}& {30.}& {6.}& {7.}& {14.}& {8.}& {13.}& {\dots }\\ {8.}& {9.}& {0.}& {2.}& {24.}& {12.}& {28.}& {21.}& {9.}& {0.}& {\dots }\\ {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {⋮}& {}\end{array}\right]\\ \hfill {\text{20 × 30 Matrix}}\end{array}$ (2)
 > $\mathrm{A2}\left[1..3,1..3\right]$
 $\left[\begin{array}{ccc}{4.}& {0.}& {3.}\\ {9.}& {4.}& {21.}\\ {11.}& {26.}& {3.}\end{array}\right]$ (3)
 > $\mathrm{A3}≔\mathrm{Random}\left(31,3,0,\mathrm{integer}\left[\right]\right)$
 ${\mathrm{A3}}{≔}\left[\begin{array}{c}{28}\\ {29}\\ {22}\end{array}\right]$ (4)
 > $\mathrm{whattype}\left(\mathrm{A3}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{column}}}$ (5)
 > $\mathrm{A4}≔\mathrm{Random}\left(31,0,5,\mathrm{float}\left[8\right]\right)$
 ${\mathrm{A4}}{≔}\left[\begin{array}{ccccc}{12.}& {27.}& {10.}& {14.}& {17.}\end{array}\right]$ (6)
 > $\mathrm{whattype}\left(\mathrm{A4}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{row}}}$ (7)