title: Is there a way to give a function two random parameters, and have them be the same?
body: <p>Say I want to call a built in function (meaning I cannot change it):</p>
  <pre><code>foo(int x,  int y)
  </code></pre>
  <p>And I want the parameters of x and y to be random, but be the <em>same</em> random number. I know I can do this with</p>
  <pre><code>double rand = Math.random();
  foo(rand, rand);
  </code></pre>
  <p>However, is there any way to do this in one line, without declaring a separate variable? Such as</p>
  <pre><code>foo(Math.random(), Math.random());
  </code></pre>
  <p>but have them be the same. Just curious if there's a simple way to do this I'm not aware of that avoids adding the extra line. Maybe something I can feed into the second parameter that basically tells it &quot;make this the same as the first parameter&quot;? Any help is greatly appreciated.</p>