骰子
为浏览器和 nodejs 掷骰子的 Javascript 助手
安装
您也可以通过 NPM 和 BOWER 安装。
bower install diceyjs
npm install diceyjs
用法
有很多方法可以使用它。 因此,您可以随意使用它。
var Dicey = require ( './dicey.js' ) ;
Dicey . roll ( 3 , 15 ) ; // Will return a random number from 3 to 15
Dicey . roll ( 50 ) ; // Will return a random number from 0 to 50
Dicey . roll ( '2d10' ) ; // Will return a random number from 2 to 20
随机化方法
默认情况下有 5 种随机化方