title: How to generate a list of random numbers?
body: <p>This might be the least important Scala question ever, but it's bothering me.  How would I generate a list of n random number.  What I have so far:</p>
  
  <pre><code>def n_rands(n : Int) = {
   val r = new scala.util.Random
   1 to n map { _ =&gt; r.nextInt(100) } 
  }
  </code></pre>
  
  <p>Which works, but doesn't look very Scalarific to me.  I'm open to suggestions.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Not because it's relevant so much as it's amusing and obvious in retrospect, the following looks like it works:</p>
  
  <pre><code>1 to 20 map r.nextInt
  </code></pre>
  
  <p>But the index of each entry in the returned list is also the upper bound of that last.  The first number must be less than 1, the second less than 2, and so on.  I ran it three or four times and noticed "Hmmm, the result always starts with 0..."</p>