[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bongo-patches] Seed the random number generator (suggested by Anthony C
From: |
Daniel Brockman |
Subject: |
[bongo-patches] Seed the random number generator (suggested by Anthony Chaumas-Pellet) |
Date: |
Tue, 03 Apr 2007 19:33:08 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
2007-04-03 Daniel Brockman <address@hidden>
Seed the random number generator (suggested by Anthony
Chaumas-Pellet).
diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el 2007-04-03 19:32:57.000000000 +0200
+++ new-bongo/bongo.el 2007-04-03 19:32:57.000000000 +0200
@@ -2230,9 +2230,15 @@
(point)
(bongo-point-at-next-line-satisfying predicate)))
+(defvar bongo-random-number-generator-seeded nil
+ "Non-nil if Bongo has seeded the random number generator.")
+
(defun bongo-point-at-random-line-satisfying (predicate)
"Return the position of a random line satisfying PREDICATE.
If there are no lines that satisfy PREDICATE, loop forever."
+ (unless bongo-random-number-generator-seeded
+ (random t)
+ (setq bongo-random-number-generator-seeded t))
(save-excursion
(while (progn (goto-line (+ (point-min)
(random (count-lines (point-max)
--
Daniel Brockman <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bongo-patches] Seed the random number generator (suggested by Anthony Chaumas-Pellet),
Daniel Brockman <=