Random

Matrix.Random({$min$,$max$},{$m$,$n$}) returns a matrix of size $m \times n$ where every entry is a random number between $min$ and $max$.

If the option “Userdata” is set to false (default is true) the output is returned as a table of tables rather than a pointer (compare Matrix.ToUserdata() and Matrix.ToTable()).

Example

Input

Example.Quanty
M = Matrix.Random({0,1},{10,10})
print(M)

Result

{ {  0.6074 ,  0.9832 ,  0.3924 ,  0.8776 ,  0.1653 ,  0.0908 ,  0.8702 ,  0.0382 ,  0.4332 ,  0.0992 } ,
  {  0.9531 ,  0.9762 ,  0.5375 ,  0.212  ,  0.5704 ,  0.4976 ,  8.8e-4 ,  0.8197 ,  0.2203 ,  0.0363 } ,
  {  0.3784 ,  0.8611 ,  0.2327 ,  0.9917 ,  0.7887 ,  0.2194 ,  0.8188 ,  0.7279 ,  0.1432 ,  0.0646 } ,
  {  0.5039 ,  0.0275 ,  0.2169 ,  0.3123 ,  0.0083 ,  0.0733 ,  0.0546 ,  0.4117 ,  0.0843 ,  0.9678 } ,
  {  0.0507 ,  0.1619 ,  0.3638 ,  0.4064 ,  0.4059 ,  0.4062 ,  0.2668 ,  0.7531 ,  0.7688 ,  0.5405 } ,
  {  0.0944 ,  0.1577 ,  0.5142 ,  0.6172 ,  0.6654 ,  0.7159 ,  0.1547 ,  0.9404 ,  0.8502 ,  0.7191 } ,
  {  0.4883 ,  0.1185 ,  0.3713 ,  0.7633 ,  0.5692 ,  0.7755 ,  0.9269 ,  0.9176 ,  0.6719 ,  0.1077 } ,
  {  0.6962 ,  0.2313 ,  0.0404 ,  0.8018 ,  0.6286 ,  0.7298 ,  0.4303 ,  0.5281 ,  0.3907 ,  0.8758 } ,
  {  0.2922 ,  0.9842 ,  0.4675 ,  0.6577 ,  0.5434 ,  0.2642 ,  0.5939 ,  0.9292 ,  0.7424 ,  0.1221 } ,
  {  0.8107 ,  0.5938 ,  0.8941 ,  0.7653 ,  0.2285 ,  0.9924 ,  0.6024 ,  0.0383 ,  0.3621 ,  0.5079 } }

Table of contents

Print/export