Quantum random number generator (QRNG) relies on the intrinsic randomness of quantum mechanics to produce true random numbers which are important in information processing tasks. Due to the presence of the superposition state, quantum computer can be used as a true random number generator. However, in practice, the implementation of quantum computer is subject to various noise sources which affect the randomness of the generated random numbers. To solve this problem, we propose a source-independent QRNG (SI-QRNG) scheme based on quantum computer which is motivated by the SI-QRNG scheme in quantum optics. The scheme can provide certified randomness by estimating the preparation error of superposition states in real time even when the source is untrusted, under the assumption that the measurement operation is trusted. Our analysis takes into account the readout error of quantum state and further gives the final extracted number of random bits. And the estimation method of preparation error of superposition state in randomness source. We also provide a parameter optimization method to increase the generation rate of random bits. In addition, by utilizing the cloud superconducting quantum computer of IBM, we experimentally demonstrate the practicality of our SI-QRNG scheme and achieve the generation of true random numbers.