title: Generate a random number which fulfills some conditions
body: <p>I want to generate a random number which shouldn't be greater than variable 'max' and fulfills the condition below:</p>
  
  <pre><code>    int fi= 17;
      int max=96;
      int i=1;
      int rez=0;
      while(i&lt;max) 
      {
          if((i*max)%fi==1) rez=i;
           i++;
      }
      System.out.println(rez);
  </code></pre>
  
  <p>The result is always 0.What is wrong?</p>