The randomness from a quantum random number generator (QRNG) relies on the accurate characterization of its devices. However, device imperfections and inaccurate characterizations can result in wrong entropy estimation and bias in practice, which highly affects the genuine randomness generation and may even induce the disappearance of quantum randomness in an extreme case. Here we experimentally demonstrate a measurement-device-independent (MDI) QRNG based on time-bin encoding to achieve certified quantum randomness even when the measurement devices are uncharacterized and untrusted. The MDI-QRNG is randomly switched between the regular randomness generation mode and a test mode, in which four quantum states are randomly prepared to perform measurement tomography in real-time. With a clock rate of 25 MHz, the MDI-QRNG generates a final random bit rate of 5.7 Kbps. Such implementation with an all-fiber setup provides an approach to construct a fully-integrated MDI-QRNG with trusted but error-prone devices in practice.