Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

dice

// usage randBox.d4() randBox.d6() randBox.d8() randBox.d10() randBox.d12() randBox.d20() randBox.d30() randBox.d100()

Return a value equal to the roll of a die.

randBox.d20(); => 13 randBox.d6(); => 4

These are just wrappers around natural() but are convenient for use by games.

They return values between 1 and the number after the d, so randBox.d4() returns 1, 2, 3, or 4, just like a 4 sided die would.

Last updated on: