at random vs out of a hat

at random

prep
  • Randomly, haphazardly. 

out of a hat

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