public Code compareRand(int a) {
        if ((a >= rand) || (a < 0)) {
            return Code.OUTOFRANGE;
        } else if (a == number) {
            return Code.COINCIDENCE;
        } else if (a > number && a < rand) {
            return Code.GREAT;
        } else if (a < number && a > 0) {
            return Code.LESS;
        } else return Code.ERROR;
    }