out of a hat vs randomly

out of a hat

randomly

adv
  • By random access; at any point at a given time; not sequentially. 

  • In a random manner. 

How often have the words out of a hat and randomly occurred in a corpus of books? (source: Google Ngram Viewer )