# WOINAttribute -> Dice Formula

#### Morrus

##### Well, that was fun
Staff member
I’d like to make a little web tool to convert attributes to dice. Mainly so we can have an infinite scale rather than one as big as somebody can make a manual table.

My friend came up with this equation:

( -1 + SquareRootOf (1 + ( 8 * Stat ) ) ) / 2 = Number of dice (round them down)

So —

1) does that work?
2) how do I do that in PHP?

#### TheHirumaChico

##### Explorer
I threw your formula, with a minor tweak or two { =TRUNC((SQRT((1+(8*Stat)))-1)/2, 0) } into Excel and the results match up to the numbers shown in the attributes table on p. 17 in WOIN:NOW book. But I'm no math whiz, so I don't know by looking at this if the formula will break at some point, like at a very high number. The key change to the formula is that you need to truncate/floor, not round, the result to get the number of dice.

I'm a Java programmer, don't really know PHP, but after a quick Google search I have come up with the following:
<?php
floor(((sqrt((1+(8*Stat))))-1)/2);
?>

You can test it out here: PHP Tryit Editor v1.2 (just replace the "pi()" in the page with my blue text above, and replace "Stat" with actual numbers to test). Hope this helps.

Last edited:

#### Morrus

##### Well, that was fun
Staff member
Thanks to your help, we now have a simple online dice pool calculator!

Now to work out how to do the reverse - what's the minimum stat needed to get a specified number of dice?

#### Morrus

##### Well, that was fun
Staff member
Which it turns out my GCSE algebra was sufficient to calculate!

#### BlckKnght

##### Explorer
The stats that correspond to each number of dice are the triangular numbers. Going from stat ranks to dice is the triangular root.

Replies
4
Views
2K
Replies
29
Views
9K
Replies
70
Views
4K
Replies
3
Views
2K
Replies
4
Views
526