Dice roller for combat sim

October 6, 2009
by Stefan Terry (smt09)

so apparently I’m not the only one doing one, so to make some of your lives easier, here’s the dice roller:

#lang scheme

(define gigadice
(lambda (sides quantity)
(cond
((zero? quantity) ‘())
(else
(cons (+ 1 (random sides)) (gigadice sides (sub1 quantity)))))))

It’s actually really simple–it’s just a random number generator and a recursive call.



Leave a Reply

You must be logged in to post a comment.