The violation of a Bell inequality implies the existence of nonlocality, making device-independent randomness certification possible. This paper derives a tight upper bound for the maximal quantum violation of Gisin’s elegant Bell inequality (EBI) for arbitrary two-qubit states, along with the constraints required to achieve this bound. This method provides the necessary and sufficient conditions for violating the EBI for several quantum states, including pure two-qubit states and the Werner states. The lower bound of certifiable global randomness is analyzed based on the tight upper bound of the EBI for pure two-qubit states, with a comparison to the Clauser-Horne-Shimony-Holt (CHSH) inequality. The relationship between the noise level and the lower bound of certifiable global randomness with respect to the Werner states is also explored, and the comparisons with both the CHSH inequality and the chained inequality are given. The results indicate that when the state approaches a maximally entangled state within specific quantified ranges, the EBI demonstrates advantages over both the CHSH inequality and the chained inequality, providing theoretical guidance for experimental device-independent quantum random number generation.