Is there a package/function for shuffling the paragraphs in the buffer? (I mean to sort the paragraphs with a random order, not changing the paragraphs, just randomizing their order).
Motivation: For learning vocabulary of a foreign language, research shows that it is better to change the order of the words you study. There is such a thing as “serial” learning such that a fixed order becomes itself a trigger in remembering the word. See http://rharriso.sites.truman.edu/vocabulary-and-word-formation/vocabulary-home/tips-on-learning-vocabulary/. Imagine you have a buffer in which every paragraph contains a word and its meaning. It would be great to change the order of paragraphs.
Edit: Based on the idea given by Politza, here is a solution:
(defun random-sort-paragraphs (reverse beg end) (interactive "P\nr") (save-excursion (save-restriction (if (region-active-p) (narrow-to-region beg end)) (goto-char (point-min)) (sort-subr reverse (function (lambda () (while (and (not (eobp)) (looking-at paragraph-separate)) (forward-line 1)))) 'forward-paragraph nil nil (lambda (s1 s2) (eq (random 2) 0))))))