We study the fraction f of nucleotides involved in the formation of a cactuslike secondary structure of random heteropolymer RNA-like molecules. In the low-temperature limit, we study this fraction as a function of the number c of different nucleotide species. We show, that with changing c, the secondary structures of random RNAs undergo a morphological transition:f(c)→1 for c≤ccr as the chain length n goes to infinity, signaling the formation of a virtually perfect gapless secondary structure; while f(c)<1 for c>ccr, which means that a nonperfect structure with gaps is formed. The strict upper and lower bounds 2≤ccr≤4 are proven, and the numerical evidence for ccr is presented. The relevance of the transition from the evolutional point of view is discussed.