l-99

solutions to l-99 (slow)
Log | Files | Refs | Feed | README

commit 3fc32e0481212e74665f4296eb95c578352037a1
parent 1a856bc72749c4f80a3c791810d1a0d5de4abbce
Author: Jenny Doe <tng@soykaf.me>
Date:   Sun, 12 May 2019 20:10:06 +0200

added: p24.scm p25.scm

Diffstat:
Ap24.scm | 13+++++++++++++
Ap25.scm | 11+++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/p24.scm b/p24.scm @@ -0,0 +1,13 @@ +; (*) 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. + +(load "p22.scm") +(load "p23.scm") + +(define (lotto-select n m) + (rnd-select (range 1 m) n)) diff --git a/p25.scm b/p25.scm @@ -0,0 +1,11 @@ +; (*) Generate a random permutation of the elements of a list. +; Example: +; * (rnd-permu '(a b c d e f)) +; (B A D C E F) +; +; Hint: Use the solution of problem P23. + +(load "p23.scm") + +(define (rnd-permu ls) + (rnd-select ls (length ls)))