JQuery/JavaScript: Using a random number generator as a setInterval() timer
<p>I'm a novice with JS/Jquery and I'm trying to have an image appear at a random place at a set interval (like a whack-a-mole game), which is currently set to repeat every 3 seconds, but I want to have the image appear at a random time between 1 and 2 seconds. </p>

<p>Here is the code I'm having issues with:</p>

<pre><code>var roleTime = Math.floor(Math.random()*(2000-1000));
        setInterval(function(){
            randRole();

        }, 3000);
</code></pre>

<p>I try to use the roleTime variable in place of the 3000ms but it just causes the image rapidly fill the div that it is contained in.</p>