title: Using a double value in Thread.sleep() function java
body: <p>Basically my issue is that I have a random number generator that generates a random <code>double</code> value between the user given int +- 0.5: </p>
  
  <pre><code>double actualClickInterval = (ThreadLocalRandom.current().nextDouble(clickinterval - 0.5, clickinterval + 0.5 +1));
  </code></pre>
  
  <p>Where <code>clickinterval</code> is the user given int.</p>
  
  <p>This double value is supposed to be passed to <code>Thread.sleep()</code>, which requires a Long value instead. If I convert it to a Long value, the decimals disappear. Is there any way around this?</p>
  
  <p>Current Thread.sleep() code is as follows:</p>
  
  <pre><code>Thread.sleep((long)actualClickInterval * 1000 - 500); 
  </code></pre>
  
  <p>I need the value to be a double, because the performed task needs to be done with random delays that are &lt; 500ms long. Any other methods of doing this are welcome as well.</p>