Random number generator, breaks for small numbers
<p>Here is my code:</p>

<pre><code>    var randomNumber = function(from,to,dec)
{
    var num = Math.random()*(to-from+1)+from;
    var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
    return result;
};
</code></pre>

<p>The goal is to get random numbers within a given range and round the result to a given decimal place. It works fine for ranges like 1-10 or 50-100, but when I try a small number like so:</p>

<pre><code>randomNumber(0.01,0.05,5)
</code></pre>

<p>I get bad results like 0.27335 and 1.04333.</p>
