For graphs G and H, let G rb--> H denote the property that, for every proper edge-colouring of G, there is a rainbow H in G. For every graph H, the threshold function prbH = prbH(n) of this property in the random graph G(n, p) satisfies pHrb = O (n-1/m(2)(H)), where m(2)(H) denotes the so-called maximum 2-density of H. Completing a result of Nenadov, Person, Skoric acute accent , and Steger [J. Combin. Theory Ser. B 124 (2017), 1-38], we prove a matching lower bound for pKrbk for k 5. Furthermore, we show that pKrb4 =n-7/15 n-1/m(2)(K4). (c) 2023 Elsevier B.V. All rights reserved.