title: Random number between zero and one in c++
body: <p>i want to create a random number between 0 and 1 but my codes output is zero.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  int main()
  {
    srand(time(0));
  
    for(int x=0;x&lt;100;x++)
    {
        cout&lt;&lt;(rand()%10)/10&lt;&lt;endl;
    }
    return 0;
  }
  </code></pre>