RandomIntMatrix
Returns a matrix with random integer entries.
Syntax
-
RandomIntMatrix(n[, m], A, B)
-
n
andm
are positive integers -
A
andB
are integers withB > A
-
Description
RandomIntMatrix(n, m, A, B)
returns a matrix of size n×m
in which each entry is a random integer in [A, B) ∩ ℤ
. If omitted, m
defaults to n
, thus creating a square matrix.
Examples
mean(compute(RandomIntMatrix(5, 0, 10), n, 1, 1000000))
⎛4.499301 4.49524 4.499266 4.501245 4.497394⎞ ⎜4.499918 4.49871 4.501145 4.498412 4.496046⎟ ⎜4.498454 4.502551 4.501222 4.500749 4.498173⎟ ⎜4.498911 4.49677 4.497124 4.501673 4.503941⎟ ⎝4.496425 4.501646 4.497137 4.494262 4.497772⎠
mean(compute(RandomIntMatrix(5, 2, 0, 10), n, 1, 1000000))
⎛4.498814 4.503407⎞ ⎜4.495916 4.498425⎟ ⎜4.495324 4.499346⎟ ⎜4.502707 4.497009⎟ ⎝4.498633 4.498722⎠