A fairly simple program that I tried to write in Common Lisp in order to practice/learn. I'm sure this can be done more elegantly but Lisp's string handling seems to be very werd.
(defun d20 () (+ 1 (random 19)))
(defun initlist (specs)
(let* ((ilist (map 'list #'(lambda (n) `(,(first n) ,(+ (second n) (d20)))) specs))
(sortedilist (sort ilist #'> :key #'second)))
sortedilist))
(defun htmlinitlist (specs)
(apply #'uiop:strcat `("<table><tr><td> </td><td> </td></tr>"
,@(loop for (a b) in (initlist specs) collecting
(format nil "<tr><td>~A</td><td>~A</td></tr><tr><td> </td><td> </td></tr>"
a b))
"</table>")))
(defun htmlinitlists (specs count)
(format nil "~{ ~A~}" (loop for i from 0 to count collecting (htmlinitlist specs))))
Sample usage from REPL:
(htmlinitlists '(("Elvish" 5) ("Wizgit" 2) ("Alaric" 8) ("Pounder" 6)) 17)