xah talk show 2022-07-31 emacs lisp, command to insert-random-string, hexadecimal, uuid, base64, WolframLang base36
number 053 511 237 949 hexadecimal 1e38e 6e531 f9c7627c76 75b8e17cf0971f5dba95 random sring Q7twY 5Sbg8 NrCc6 fZsR8 uuid 81c34788-16c1-424b-b21e-b9ea438ab32a
(defun xah-insert-random-string (CountX) "Insert a random alphanumerics string of length 5. The possible chars are digits and upper/lower case English letters but without any vowels nor Ll01. Call `universal-argument' before for different count. URL `http://xahlee.info/emacs/emacs/elisp_insert_random_number_string.html' Version: 2020-07-19" (interactive "P") (let* (($charset "bcdfghjkmnpqrstvwxyz23456789BCDFGHJKMNPQRSTVWXYZ") ($baseCount (length $charset))) (dotimes (_ (if (numberp CountX) (abs CountX) 5)) (insert (elt $charset (random $baseCount)))))) (defun xah-insert-hex () "Version: 2022-07-31" (interactive) (insert (format "%x" (random 1000000000)))) ;; 137c0 ;; 160a0 ;; b8e0 ;; 16e9b ;; 136e6 ;; e1e6ed0 ;; 13b5cbeb ;; b0ff85c ;; 151980be ;; 3fa3ffa ;; 287d6e5 ;; 0 to 9 , 48 to 57 ;; a to z, 97 to 122 ;; A to Z , 65 to 90 ;; 62 total chars (defun xah-insert-random-2 () "Insert a random alphanumerics string of length 5. Insert any of A to Z, a to z, and 0 to 9. Version: 2022-07-31" (interactive) (let* ((xdigitRangeStart 48) (xdigitRangeEnd 57) (xdigitRange (- xdigitRangeEnd xdigitRangeStart)) (xlowAZRangeStart 97) (xlowAZRangeEnd 122) (xlowAZRange (- xlowAZRangeEnd xlowAZRangeStart)) (xCapAZRangeStart 65) (xCapAZRangeEnd 95) (xCapAZRange (- xCapAZRangeEnd xCapAZRangeStart)) xrandomDigit ) (setq xrandomDigit (+ (random xdigitRange) xdigitRangeStart)) (insert (char-to-string xrandomDigit))))
BaseEncode[StringToByteArray["(defun xah-insert-hex () \"Version: 2022-07-31\" (interactive) (insert (format \"%x\" (random 1000000000)))"]]
arbitrary number base
BaseForm[100, 17]
- emacs
base64-encode-region
"(defun xah-insert-hex () \"Version: 2022-07-31\" (interactive) (insert (format \"%x\" (random 1000000000)))" "KGRlZnVuIHhhaC1pbnNlcnQtaGV4ICgpCiAgIlZlcnNpb246IDIwMjItMDctMzEiCiAgKGludGVy YWN0aXZlKQogIChpbnNlcnQgKGZvcm1hdCAiJXgiIChyYW5kb20gMTAwMDAwMDAwMCkpKSkK"
printed representation of elisp data structure
[1 3 4] (list 2 4 5) (setq myHash (make-hash-table :test 'equal)) (puthash "joe" 19 myHash) myHash [12 "172"]