[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Randomly capitalise letters
From: |
Sean McAfee |
Subject: |
Re: Randomly capitalise letters |
Date: |
Mon, 26 Nov 2012 10:13:09 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
"Pascal J. Bourguignon" <pjb@informatimago.com> writes:
> (defun capitalize-randomly (start end)
> (interactive "r")
> (goto-char start)
> (while (< (point) end)
> (let ((ch (char-after (point))))
> (delete-region (point) (1+ (point)))
> (insert (format "%c" (if (zerop (random 2))
> (upcase ch)
> (downcase ch)))))))
It's worth noting that if you regularly use Emacs for producing random
numbers, you probably want to put "(random t)" in your .emacs file to
seed the random number generator. I once wrote some routines to
generate random events for an online game I was running, and it took a
little while for me to notice that the same events were regularly
occurring in the same order every morning.