title: Can this code be reverse-engineered to find the random seed?
body: <pre><code>local digits = {'1', '2', '3', '4', '5', '6', '8', '9'} 
  math.randomseed(os.time()) 
  local result = digits[math.random(8)] 
  for i = 2, 50 do 
      result = result..digits[math.random(8)] 
  end 
  print(result)
  
  --&gt; 88854243421464255299891111895292628431988589634664
  </code></pre>
  
  <p>This is a Lua script designed to spit out fifty random digits, excluding 0 and 7. I can't seem to find the Lua randomness algorithm. Is it possible to find the value returned by os.time()? </p>
  
  <p>To put it in layman's terms, here's how the script works:</p>
  
  <ol>
  <li>Define a list of eight single-character strings.</li>
  <li>Seed the pseudo-random algorithm with the number of seconds since midnight on January 1, 1970.</li>
  <li>Select a number between one and eight using the pseudo-random algorithm, then use that to select an item from the list. E.g. the number selected is seven, the algorithm picks the seventh item in the list. </li>
  <li>Add that item onto the end of the result. Repeat until the result is fifty digits long.</li>
  </ol>
  
  <p>So because seven is left out, the random algorithm really spit this out:</p>
  
  <pre><code>77754243421464255288781111785282627431877578634664
  </code></pre>
  
  <p>But because seven is missing, seven and eight became eight and nine, yielding this:</p>
  
  <pre><code>88854243421464255299891111895292628431988589634664
  </code></pre>
  
  <p>To clarify, I'm trying to figure out how the random algorithm works to find the key that was entered as a random seed. </p>
  
  <p>Also asked here: <a href="https://forum.roblox.com/Forum/ShowPost.aspx?PostID=215349554" rel="nofollow noreferrer">https://forum.roblox.com/Forum/ShowPost.aspx?PostID=215349554</a>
  and here: <a href="https://scriptinghelpers.org/questions/42360/can-this-script-be-reverse-engineered-to-find-the-random-seed" rel="nofollow noreferrer">https://scriptinghelpers.org/questions/42360/can-this-script-be-reverse-engineered-to-find-the-random-seed</a>
  and here: <a href="https://crypto.stackexchange.com/questions/47027/can-this-code-be-reverse-engineered-to-find-the-random-seed">https://crypto.stackexchange.com/questions/47027/can-this-code-be-reverse-engineered-to-find-the-random-seed</a></p>