RandomMatrix
Returns a matrix containing random real numbers from [0, 1).
Syntax
-
RandomMatrix(n[, m])-
nis a positive integer -
mis a positive integer
-
Description
RandomMatrix(n, m) returns a matrix of size n×m containing random real numbers from [0, 1). If omitted, m will default to n, thus creating a square matrix.
mean(compute(RandomMatrix(5), n, 1, 1000000))
⎛0.499721489374 0.499853258161 0.500354557889 0.499925569883 0.499987368487⎞ ⎜0.500071914039 0.499683701358 0.499915420102 0.499647346445 0.500161750669⎟ ⎜0.500113181198 0.499874115263 0.499841364548 0.499577865172 0.499754436146⎟ ⎜0.499908614672 0.499662047445 0.500325521418 0.500276488677 0.499465546335⎟ ⎝0.499950113291 0.500524200807 0.500006198915 0.49957547649 0.500308721403⎠
mean(compute(RandomMatrix(5, 2), n, 1, 1000000))
⎛0.500038996163 0.499872559157⎞ ⎜0.499497109067 0.49953861144⎟ ⎜0.499906278042 0.500143337879⎟ ⎜0.499841036794 0.50008435817⎟ ⎝ 0.49977223966 0.500347723298⎠