fork download
  1. (let ((size 9999))
  2. (multiple-value-bind (s sum avg min max)
  3. (loop with s = (make-array size :initial-element 0)
  4. with r = size
  5. until (zerop r)
  6. for n = (random size)
  7. when (zerop (aref s n))
  8. do (decf r)
  9. do (incf (aref s n))
  10. sum 1 into sum
  11. minimize (aref s n) into min
  12. maximize (aref s n) into max
  13. finally (return (values s sum (/ sum size) min max)))
  14. (format t "~@{~S~%~}" sum (float avg) (list min max))
  15. (loop for n from min to max
  16. do (format t "~A~4T~S~%" n (count n s)))))
  17.  
Success #stdin #stdout 0.02s 29348KB
stdin
Standard input is empty
stdout
98413
9.842284
(1 27)
1   8
2   36
3   74
4   210
5   409
6   644
7   956
8   1148
9   1209
10  1319
11  1138
12  924
13  709
14  490
15  312
16  197
17  109
18  42
19  35
20  16
21  8
22  4
23  1
24  0
25  0
26  0
27  1