title: Securely Use Random Number Generator for Lottery Winning
body: <p>I want to design a lottery winning mechanism using random number generator. I know that for computer, there is no true randomness but only "pseudorandom". If the system gets hacked and random seed is seen, people will know the sequence of random numbers. In fact, there is news that people did this and won several lotteries. I am thinking about two ways of designing my system:</p>
  
  <ol>
  <li><p>Use random number generator as a global variable. There is only one
  random seed; the sequence is generated when the system starts.</p>
  
  <p>Con: </p>
  
  <p>a. Once the random seed is seen, hackers will know the sequence
  easily.     </p>
  
  <p>b. Once the system crashes and restarts, the sequence will repeat
  itself.</p></li>
  <li><p>Create a random number generator using timestamp as random seed each
  time to generate a number. </p>
  
  <p>Con: </p>
  
  <p>a. Obviously timestamp cannot be directly used. There are some
  tricks needed to be done with the timestamp each time. For example,
  plus or minus some values each time on the timestamp. What algorithm can I use here to do this kind of modification on timestamp?</p>
  
  <p>b. Is this method even taking advantage of random number generator?
  It seems I am just creating a random number by myself...</p></li>
  </ol>
  
  <p>As we can see, either of the method above is not secure enough. Which way is slightly better? Or is there a better way?</p>