+2004-06-04 TAKAHASHI Kaoru <kaoru@kaisei.org>
+
+ * riece-hangman.el (riece-hangman-word): Check killed-buffer or
+ not. Fix random number generation logic.
+
2004-06-03 Daiki Ueno <ueno@unixuser.org>
* riece-server.el (riece-open-server): When password input is
(defun riece-hangman-word ()
"Return random word.
The wordlist is read from `riece-hangman-words-file'."
- (unless riece-hangman-words-buffer
+ (unless (and riece-hangman-words-buffer
+ (buffer-name riece-hangman-words-buffer))
(setq riece-hangman-words-buffer (generate-new-buffer " *riece-hangman*"))
(save-excursion
(set-buffer riece-hangman-words-buffer)
(delete-non-matching-lines "^[a-z][a-z][a-z][a-z][a-z][a-z]+"))))
(save-excursion
(set-buffer riece-hangman-words-buffer)
- (goto-char (% (1+ (random)) (buffer-size)))
+ (goto-char (1+ (random (buffer-size))))
(if (eobp)
(beginning-of-line -1)
(beginning-of-line))