How can I generate random number between 0 and 2 excluding 1? The function I am currently using is:
public static int DecRandomNumber(int min, int max)
{
      lock (syncLock)
      {
           // synchronize
           int val = Convert.ToInt32(random.Next(0, 3));
           return(val == 1 ? 2 : 0);
      }
}
However this is not at all generalized as I am not using min and max and happen to know that min will always be 1 and max be 3. What's the best way to achieve this? Thanks.
 
     
     
    