Reverse engineering code : <p>I am currently doing an assignment where I have to write a code to decrypt a text file that is given to me. I am just stuck on how to reverse engineer the encrypting code, which is as follow:</p>

<pre><code>char decode(char aChar)
{
  int result = 1 + (rand() % 127);
  result = aChar - result;

  if (result &lt; 0)
  {
    result = result - 128;
  }
  return result;
}
</code></pre>

<p>My code works but when I run the program it encrypts the already encrypted text file. Any help would be much appreciated.</p>
