http://www.perlmonks.org?node_id=1174609


in reply to Dungeons and Dragons die roller (Golf)

To steal choroba's post:

echo 2d12+13 | \ perl -ple ' ($d,$s,$_)=split/[d+]/;map$_+=1+rand$s,1..$d ' 1 2 3 4 12345678901234567890123456789012345678901234