Abstract. The standard algorithm for fast generation of Erdős-Rényi random graphs only works in the Real RAM model. The critical point is the generation of geometric random variates Geo(p), for which there is no algorithm that is both exact and efficient in any bounded precision machine model. For a RAM model with word size w = Ω(log log(1/p)), we show that this is possible and present an exact algorithm for sampling Geo(p) in optimal expected time O(1 + log(1/p)/w). We also give an exact algorithm for sampling min{n, Geo(p)} in optimal expected time O(1+log(min{1/p, n})/w). This yields a new exact algorithm for sampling Erdős-Rényi and Chung-Lu random graphs of n vertices and m (expected) edges in optimal expected runtime O(n + m) on a RAM with word size w = Θ(log n).