summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-fun.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-24 19:41:03 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-24 19:41:03 +0200
commit35d0675467e61aff30c21544f87f55b1b1a2cfd3 (patch)
treedfbc48f1575e762352d60b55bb25facfa438875b /lisp/gnus/gnus-fun.el
parent8fbf816ccd0fe223568d6c31c4571ca45dffaa8d (diff)
downloademacs-35d0675467e61aff30c21544f87f55b1b1a2cfd3.tar.gz
Prefer seq-random-elt to nth+random
* lisp/emacs-lisp/seq.el (seq-random-elt): Autoload. * lisp/avoid.el (mouse-avoidance-random-shape): * lisp/epa-ks.el (epa-ks--query-url): * lisp/erc/erc-networks.el (erc-server-select): * lisp/gnus/gnus-fun.el (gnus--random-face-with-type) (gnus-fun-ppm-change-string): * lisp/net/soap-inspect.el (soap-sample-value-for-xs-simple-type): * lisp/obsolete/landmark.el (landmark-random-move): * lisp/play/mpuz.el (mpuz-build-random-perm): * lisp/play/zone.el (zone-pgm-stress): * lisp/vc/add-log.el (add-change-log-entry): * test/lisp/net/tramp-tests.el (tramp-test44-asynchronous-requests): Prefer seq-random-elt to nth+random.
Diffstat (limited to 'lisp/gnus/gnus-fun.el')
-rw-r--r--lisp/gnus/gnus-fun.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index 8bca4ffe38f..bfc57a2d605 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -103,7 +103,7 @@ PNG format."
(remove nil (mapcar
(lambda (f) (unless (string-match (or omit "^$") f) f))
(directory-files dir t ext))))
- (file (nth (random (length files)) files)))
+ (file (and files (seq-random-elt files))))
(when file
(funcall fun file)))))
@@ -315,7 +315,7 @@ colors of the displayed X-Faces."
(let* ((possibilities '("%02x0000" "00%02x00" "0000%02x"
"%02x%02x00" "00%02x%02x" "%02x00%02x"))
(format (concat "'#%02x%02x%02x' '#"
- (nth (random 6) possibilities)
+ (seq-random-elt possibilities)
"'"))
(values nil))
(dotimes (i 255)