Randomness is a fundamental feature in nature and a valuable resource for applications ranging from cryptography and gambling to numerical simulation of physical and biological systems. Random numbers, however, are difficult to characterize mathematically, and their generation must rely on an unpredictable physical process. Inaccuracies in the theoretical modelling of such processes or failures of the devices, possibly due to adversarial attacks, limit the reliability of random number generators in ways that are difficult to control and detect. Here, inspired by earlier work on nonlocality based and device independent quantum information processing, we show that the nonlocal correlations of entangled quantum particles can be used to certify the presence of genuine randomness. It is thereby possible to design of a new type of cryptographically secure random number generator which does not require any assumption on the internal working of the devices. This strong form of randomness generation is impossible classically and possible in quantum systems only if certified by a Bell inequality violation. We carry out a proof-of-concept demonstration of this proposal in a system of two entangled atoms separated by approximately 1 meter. The observed Bell inequality violation, featuring near-perfect detection efficiency, guarantees that 42 new random numbers are generated with 99% confidence. Our results lay the groundwork for future device-independent quantum information experiments and for addressing fundamental issues raised by the intrinsic randomness of quantum theory.