It’s useful while debugging to choose a random sample. Thus you can include something like this in application.rb or an initializer.

Now you can say Post.sample to get a single post or Post.sample(5) to get 5 of them.

See also here and apparently the randumb gem will extract random ActiveRecords too.