Bollobás and Nikiforov (J. Combin. Theory Ser. B. 97 (2007) 859-865) conjectured that for a graph G with e(G) edges and the clique number ω(G), then λ12+λ22≤2e(G)(1−ω(G)1), where λ1 and λ2 are the largest and the second largest eigenvalues of the adjacency matrix of G, respectively. In this paper, we prove that for a sequence of random graphs the conjecture holds true with probability tending to one as the number of vertices tends to infinity.