title: Random number generator javascript. How can I prevent it generating a new number on refresh?
body: <p>Ok I got this code:</p>
  
  <pre><code>&lt;font face="Arial" size="2"&gt;Your random number:&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;/br&gt;
  &lt;span class="xr_tl Normal_text" style=" top: 0px;
                                          font-family:Impact;
                                          font-size:20px;
                                          color:#c04e51;"&gt;
      &lt;script type="text/javascript"&gt;
          document.write(Math.floor(Math.random()*999999));
      &lt;/script&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>It generates a random number when you visit the page and works fine but I need it to generate a random number just once. That means when you click refresh, there is no new random number generated and the previously generated number just stays there. How can I do this? I assume it can be done by sending a cookie but I can't figure it out. </p>