diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-24 19:41:03 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-24 19:41:03 +0200 |
commit | 35d0675467e61aff30c21544f87f55b1b1a2cfd3 (patch) | |
tree | dfbc48f1575e762352d60b55bb25facfa438875b /lisp/net/soap-inspect.el | |
parent | 8fbf816ccd0fe223568d6c31c4571ca45dffaa8d (diff) | |
download | emacs-35d0675467e61aff30c21544f87f55b1b1a2cfd3.tar.gz emacs-35d0675467e61aff30c21544f87f55b1b1a2cfd3.tar.bz2 emacs-35d0675467e61aff30c21544f87f55b1b1a2cfd3.zip |
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/net/soap-inspect.el')
-rw-r--r-- | lisp/net/soap-inspect.el | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index b994b0ed862..5207ca8ff19 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -114,7 +114,7 @@ This is a specialization of `soap-sample-value' for (cond ((soap-xs-simple-type-enumeration type) (let ((enumeration (soap-xs-simple-type-enumeration type))) - (nth (random (length enumeration)) enumeration))) + (and enumeration (seq-random-elt enumeration)))) ((soap-xs-simple-type-pattern type) (format "a string matching %s" (soap-xs-simple-type-pattern type))) ((soap-xs-simple-type-length-range type) @@ -134,7 +134,7 @@ This is a specialization of `soap-sample-value' for (t (random 100))))) ((consp (soap-xs-simple-type-base type)) ; an union of values (let ((base (soap-xs-simple-type-base type))) - (soap-sample-value (nth (random (length base)) base)))) + (soap-sample-value (and base (seq-random-elt base))))) ((soap-xs-basic-type-p (soap-xs-simple-type-base type)) (soap-sample-value (soap-xs-simple-type-base type)))))) |