title: generating a random double between 0 and infinity in java
body: <p>I have this code</p>
  
  <p>and I'm trying to send a random double to the method "fun"</p>
  
  <p>BL is a double equal 1 here</p>
  
  <pre><code>   double inf=Double.POSITIVE_INFINITY;
     double rand=inf*R.nextDouble();
     double myrand=fun(rand)*BL;
     mylist.get(i).set_speed(myrand);
  </code></pre>
  
  <p>and here is the "fun" method</p>
  
  <pre><code>double fun(double v)
  {
     return ((pow(A,K)*exp((-1)*A*v)*pow(v,K-1))/(fact(K-1)));
  }
  </code></pre>
  
  <p>But the output of the speed parameter is always NaN</p>