public static int RandomNumber(int min, int max) { lock ( syncLock ) { // synchronize return random.Next (min, max); } }