June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,7 +1,11 @@
(de shuffle (Lst)
(make
(for (N (length Lst) (gt0 N))
(setq Lst
(conc
(cut (rand 0 (dec 'N)) 'Lst)
(prog (link (car Lst)) (cdr Lst)) ) ) ) ) )
(seed (in "/dev/urandom" (rd 8)))
(de knuth (Lst)
(for (N (length Lst) (>= N 2) (dec N))
(let I (rand 1 N)
(xchg (nth Lst N) (nth Lst I)) ) ) )
(let L (range 1 15)
(println 'before L)
(knuth L)
(println 'after L) )