Function: artist-spray-random-points

artist-spray-random-points is a byte-compiled function defined in artist.el.gz.

Signature

(artist-spray-random-points N RADIUS)

Documentation

Generate N random points within a radius of RADIUS.

Returns a list of points. Each point is on the form (X1 . Y1).

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-spray-random-points (n radius)
  "Generate N random points within a radius of RADIUS.
Returns a list of points.  Each point is on the form (X1 . Y1)."
  (let ((points))
    (while (> n 0)
      (let* ((angle (degrees-to-radians (random 359)))
	     (dist  (random radius))
	     (point (cons (round (* dist (cos angle)))
			  (round (* dist (sin angle))))))
	(setq points (cons point points)))
      (setq n (- n 1)))
    points))