title: C++ - Setting ints from 0 to 9 as random values for Eigen library matrix
body: <p>I'm trying to make a simple random matrix multiplication program using the <em>Eigen</em> library in <em>C++</em>, but the numbers I get using the <code>setRandom();</code> function are <em>floats</em> from -1 to 1 and I want for the numbers to be <em>ints</em> from 0 to 9 instead, how do I do that?</p>
  
  <p>my code:</p>
  
  <pre><code>int mat_size;
  cout &lt;&lt; "Enter the size of the array: " &lt;&lt; endl;
  cin &gt;&gt; mat_size;
  
  MatrixXd m = MatrixXd(mat_size,mat_size);
  MatrixXd n = MatrixXd(mat_size,mat_size);
  m.setRandom();
  n.setRandom();
  
  cout &lt;&lt; "Matrix m: " &lt;&lt; endl &lt;&lt; m &lt;&lt; endl;
  cout &lt;&lt; "Matrix n: " &lt;&lt; endl &lt;&lt; n &lt;&lt; endl;
  cout &lt;&lt; "The product between m and n is: " &lt;&lt; endl;
  cout &lt;&lt; m * n &lt;&lt; endl;
  </code></pre>
  
  <p>and the output for a <code>3*3</code> matrix is always:</p>
  
  <pre><code>Matrix m: 
   0.680375   0.59688 -0.329554
  -0.211234  0.823295  0.536459
   0.566198 -0.604897 -0.444451
  Matrix n: 
     0.10794  -0.270431    0.83239
  -0.0452059  0.0268018   0.271423
    0.257742   0.904459   0.434594
  The product between m and n is: 
  -0.0384828  -0.466066   0.585123
   0.0782496   0.564396   0.280774
  -0.0260932  -0.571318   0.113959
  </code></pre>
  
  <p>I want for them to be something like:</p>
  
  <pre><code>matrix: 
  4 8 9
  3 2 7
  3 8 1
  </code></pre>