Let \(G\) be a graph of order \(n\), and let \(a\) and \(b\) be integers such that \(1 \leq a < b\). Let \(g(x)\) and \(f(x)\) be two nonnegative integer-valued functions defined on \(V(G)\) such that \(a \leq g(x) < f(x) \leq b\) for each \(x \in V(G)\). Then \(G\) has a \((g, f)\)-factor if the minimum degree \(\delta(G) \geq \frac{(b-1)^2-(a+1)(a+b-1)}{a+1}\) ,\(n>\frac{(a+b)(a+b-1)}{a+1}\) and \(\max\{d_G(x), d_G(y)\} \geq \frac{(b-1)n}{a+b}\) for any two nonadjacent vertices \(x\) and \(y\) in \(G\). Furthermore, it is shown that the result in this paper is best possible in some sense.