Comment detail

重複無し乱数 (Nested Flatten)
Arcです。
割とCommon Lispみたいになってしまいました。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
(def bingo (n)
  (let lst (iota n 1)
    (for i 0 (- n 1)
      (swap (lst i) (lst (rand n))))
    lst))

(def iota (n (o start 0) (o step 1))
  (let res ()
    (repeat n
      (push start res)
      (++ start step))
    (rev res)))

Index

Feed

Other

Link

Pathtraq

loading...