private DiffExpression randomExpression(int size) {
        if (size <= 0) {
            if (random.nextBoolean()) {
                return new Const(random.nextInt(1000));
            } else {
                return VARIABLES[random.nextInt(VARIABLES.length)];
            }
        }
        switch (random.nextInt(6)) {
            case 0:
                return new Add(randomExpression(size / 2 - 1), randomExpression(size / 2));
            case 1:
                return new Subtract(randomExpression(size / 2 - 1), randomExpression(size / 2));
            case 2:
                return new Multiply(randomExpression(size / 2 - 1), randomExpression(size / 2));
            case 3:
                return new Divide(randomExpression(size / 2 - 1), randomExpression(size / 2));
            case 4:
                return new Sin(randomExpression(size - 1));
            case 5:
                return new Cos(randomExpression(size - 1));
            default:
                throw new AssertionError("");
        }
    }