Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l
Normal file
11
Task/Knuth-shuffle/PicoLisp/knuth-shuffle.l
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(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) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue