title: Creating array of length n with random numbers in JavaScript
body: <p>Following up on <a href="https://stackoverflow.com/a/34693778/1525840">this answer</a> for creating an array of specified length, I executed the below to get a corresponding result but filled with random numbers, instead of zeros.</p>
  
  <pre><code>var randoms = Array(4).fill(Math.floor(Math.random() * 9));
  </code></pre>
  
  <p>Well, mathematically speaking <strong>it's random</strong>, all right. But I'd like the randomness to be visible within the array and not only between runs, of course. Stupid computer... Don't do what I say. Do what I want!</p>
  
  <p>I can iterate and put it my random (and varying) values. But I wonder, of pure curiosity, if it's possible to get the right result with a one-liner, like above, MatLab-style. Do I need to call <em>eval(function()...)</em>? I've heard a lot of bad things about <em>eval</em>...</p>
  
  <p>Note that the above produces code like this:</p>
  
  <blockquote>
    <p>[7, 7, 7, 7]<br>
    [3, 3, 3, 3]</p>
  </blockquote>
  
  <p>etc. while I want something like</p>
  
  <blockquote>
    <p>[1, 2, 3, 4]<br>
    [4, 3, 8, 4]</p>
  </blockquote>