title: Math.random() explanation
body: <p>This is a pretty simple Java (though probably applicable to all programming) question:</p>
  
  <blockquote>
    <p><code>Math.random()</code> returns a number between zero and one.</p>
  </blockquote>
  
  <p>If I want to return an integer between zero and hundred, I would do:</p>
  
  <pre><code>(int) Math.floor(Math.random() * 101)
  </code></pre>
  
  <p>Between one and hundred, I would do:</p>
  
  <pre><code>(int) Math.ceil(Math.random() * 100)
  </code></pre>
  
  <p>But what if I wanted to get a number between three and five? Will it be like following statement: </p>
  
  <pre><code>(int) Math.random() * 5 + 3
  </code></pre>
  
  <p>I know about <code>nextInt()</code> in <code>java.lang.util.Random</code>. But I want to learn how to do this with <code>Math.random()</code>.</p>