August 19, 2024

P24 - Lotto: Draw N different random numbers from the set 1..M

The selected numbers shall be returned in a list.

Example:* (lotto-select 6 49)(23 1 17 33 21 37)

Hint: Combine the solutions of problems P22 and P23.

lisp

(load "p22.lisp")
(load "p23.lisp")


;;; joins two other functions to produce the desired result ;;;

(defun lotto-select (num-elem max-elem)
    (rnd-select (range 1 max-elem) num-elem))
Be first to comment
Leave a reply