Last active
January 16, 2023 12:41
-
-
Save Bakudankun/94c0cf78b501bc36ede32af2bf17ed51 to your computer and use it in GitHub Desktop.
:3D6 みたいに使えるサイコロ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s:dice(count, dice) abort | |
const dices = map(range(a:count), {-> rand() % a:dice + 1}) | |
echo dices | |
if a:count <=# 1 | |
return | |
endif | |
echo 'sum:' reduce(dices, {acc, val -> acc + val}) | |
endfunction | |
command! -range=1 -addr=other -nargs=1 -bar D call s:dice(<count>, <args>) | |
" vim: et sw=2 sts=-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
License: CC0