From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sean McAfee Newsgroups: gmane.emacs.help Subject: Re: Randomly capitalise letters Date: Mon, 26 Nov 2012 10:13:09 -0800 Organization: A noiseless patient Spider Message-ID: References: <87wqxdnwkm.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1353953713 20075 80.91.229.3 (26 Nov 2012 18:15:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Nov 2012 18:15:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 26 19:15:25 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Td3DH-0005sF-SL for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Nov 2012 19:15:23 +0100 Original-Received: from localhost ([::1]:59365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Td3D6-0007HQ-Mn for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Nov 2012 13:15:12 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 17 Injection-Info: mx04.eternal-september.org; posting-host="390b8d7777f585513242ac7ea088dc17"; logging-data="26606"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nzMRdlkejAe+vOiosDVRFN6LogkNMTJQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:D8ZN8pmmfUf3MOR59GRBSMV6hWg= sha1:GhNpZM9j2fnK1I3Fyq9oQufNnjA= Original-Xref: usenet.stanford.edu gnu.emacs.help:195588 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87909 Archived-At: "Pascal J. Bourguignon" 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.