Ah, that gives a number between 1 and 19. The random number generator never spits out 1.0, so when you round down, you get a maximum of 18+1. You just want RAND()*20 + 1.Patryn of Elvenshae said:Pretty much no.
However, you can download, from the internet, any number of dice-rolling programs.
Heck, put the following in Excel and it works, too:
=RAND()*19+1
That gives you a number between 1 and 20. Round it to 0 decimal places, and you've got a virtual d20.
Chance the first number (19, above) to (die size - 1) to change the formula.
That will occasionally give you a value of 21, if you set it to 0 decimal places.CyberSpyder said:You just want RAND()*20 + 1.
CyberSpyder said:Ah, that gives a number between 1 and 19. The random number generator never spits out 1.0, so when you round down, you get a maximum of 18+1. You just want RAND()*20 + 1.
This should make sense - twenty sides, so you need to multiply by twenty.
Patryn of Elvenshae said:Not quite.
The RAND function returns a value between 0 and 1.
Multiply that by 19 and you get a value between 0 and 19.
Add 1 and you get a value between 1 and 20.
Round to 0 decimal places (not truncate), and you get a whole number between 1 and 20.
My Excel-fu is strong, and will defeat your Limp Macro Boxing style!