Created
September 10, 2019 18:13
-
-
Save victusfate/80ff7083d01f0f51d25eb42056b85f9c to your computer and use it in GitHub Desktop.
a weird way to roll dice
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
const d = (dv) => Math.floor(Math.random()*dv) | |
const sum = (sum,dv) => sum + d(dv) | |
const r = (n,dv) => Array.from({length:n}).map(x => dv).reduce(sum) | |
console.log('roll 8d12',r(8,12),'average',8 * 6.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment