Function: math-random-digits

math-random-digits is a byte-compiled function defined in calc-comb.el.gz.

Signature

(math-random-digits N)

Documentation

Produce a random N digit integer.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
;;; Produce an N-digit random integer.
(defun math-random-digits (n)
  "Produce a random N digit integer."
  (let* ((slop (% (- 3 (% n 3)) 3))
         (i (/ (+ n slop) 3))
         (rnum 0))
    (while (> i 0)
      (setq rnum
            (math-add
             (math-random-three-digit-number)
             (math-mul rnum 1000)))
      (setq i (1- i)))
    (math-normalize (math-scale-right rnum slop))))