Untitled
public text v1 · immutablerequire random.fs
: die-roll ( u1 -- u2 ) random 1+ ;
: dice-roll ( n count -- total ) 0 -rot 0 ?do tuck die-roll + swap loop drop ;
\ Example -- 2d4:
4 2 dice-roll .
require random.fs
: die-roll ( u1 -- u2 ) random 1+ ;
: dice-roll ( n count -- total ) 0 -rot 0 ?do tuck die-roll + swap loop drop ;
\ Example -- 2d4:
4 2 dice-roll .