Anonymous
public text v1 · immutablerequire random.fs
: die-roll ( sides -- result ) random 1+ ;
: dice-roll ( sides rolls -- total ) 0 -rot 0 ?do tuck die-roll + swap loop drop ;
\ Example -- 2d4:
4 2 dice-roll .require random.fs
: die-roll ( sides -- result ) random 1+ ;
: dice-roll ( sides rolls -- total ) 0 -rot 0 ?do tuck die-roll + swap loop drop ;
\ Example -- 2d4:
4 2 dice-roll .