How do I generate random numbers from [0,1]?
<p>I want to generate random numbers from [0,1].</p>

<pre><code>import os

int.from_bytes(os.urandom(8), byteorder="big") / ((1 &lt;&lt; 64) - 1)
</code></pre>

<p>The code above does not work in my python version. </p>

<p>Also</p>

<pre><code>import random

random.random() 
</code></pre>

<p>only generate random variables from [0,1) and does not include 1. I want it to be exactly [0,1] Any other ways to do this?</p>