Method Math.random - how it work? : <p>Some teacher today teach us how work Math.random in Java language. I don't understand what he told. Can some explain? I have some code:</p>

<pre><code>import java.util.Random;

public class test {

    public static void main(String[] args) {

        Random random = new Random();

        double r = Math.random() * 4.4 + 1.2;
        System.out.println(r);

    }
}
</code></pre>

<p>Next he ask us what is interval of this random. We don't know and he write:</p>

<pre><code>&lt;1.2, 5.6&gt; --&gt; &lt;0, 4.4&gt; + 1.2 --&gt; double r = Math.random() * 4.4 + 1.2;
</code></pre>

<p>How can I calculate this, what is mathematical formula? <code>&lt;1.2, 5.6&gt; --&gt; &lt;0, 4.4&gt; + 1.2</code> </p>
