title: Simple Pseudo-Random Algorithm
body: <p>I'm need a pseudo-random generator which takes a number as input and returns another number witch is reproducible and seems to be random.</p>
  
  <ul>
  <li>Each input number should match to exactly one output number and vice versa</li>
  <li>same input numbers always result in same output numbers</li>
  <li>sequential input numbers that are close together (eg. 1 and 2) should produce completely different output numbers (eg. 1 => 9783526, 2 => 283)</li>
  </ul>
  
  <p>It must not be perfect, it's just to create random but reproducible test data. </p>
  
  <p>I use C#.</p>
  
  <hr>
  
  <p>I wrote this funny piece of code some time ago which produced something random. </p>
  
  <pre><code>  public static long Scramble(long number, long max) 
    {
      // some random values 
      long[] scramblers = { 3, 5, 7, 31, 343, 2348, 89897 };
      number += (max / 7) + 6;
      number %= max;
      // shuffle according to divisibility
      foreach (long scrambler in scramblers) 
      {
        if (scrambler &gt;= max / 3) break;
        number = ((number * scrambler) % max) 
          + ((number * scrambler) / max);
      }
  
      return number % max;
    }
  </code></pre>
  
  <p>I would like to have something better, more reliable, working with any size of number (no max argument).</p>
  
  <p>Could this probably be solved using a CRC algorithm? Or some bit shuffling stuff.</p>