Take the 2-minute tour ×
Role-playing Games Stack Exchange is a question and answer site for gamemasters and players of tabletop, paper-and-pencil role-playing games. It's 100% free, no registration required.

Dice programs and their use around the table are on the rise:

  • Are there any characteristics, qualities, or quirks of results obtained by using dice programs which might detract from play? Improve it?
  • Are there dice programs which are below standard in their generation of reliable results? If so, can such results be recognized and assessed easily?

    I am asking this question about the results obtained by using dice rolling programs, not the experience or tradition of using actual dice. Personally, I prefer using dice, but am often required these days to resort to programs. Some of these programs produce what I consider to be suspicious results in much the same way those soft blue dice used to from a certain boxed game in the '80s. However, being aware of my own diceward bias, but lacking the tools to determine the veracity of my suspicions about some programs for certain, I thought this might be the place to ask~

share|improve this question
8  
It just occured to me as I was reading all the answers that take care to explain that computer generated "random" numbers aren't really random...that dice rolling isn't random either. The physical shape of the die, combine with the surface it's rolled on and the way it is tossed will produce very predictable results, given enough information. Of course, like computers, we pretend it's random, and it might as well be, because we don't have trivial access to that precise information and model that would allow the prediction. Egad...I can't believe I typed this. –  Beska Apr 30 '13 at 12:38
1  
@Beska: I worried so much about the "source" of randomness that I wrote this: github.com/neilslater/pool_of_entropy/blob/master/RATIONALE.md - that's just my "essay" in the same vein as your comment. I actually went as far as implementing a tool to wire up "you" to "your randomness", although I have no idea if anyone would ever want to use it :-) –  Neil Slater May 23 at 11:54

8 Answers 8

up vote 31 down vote accepted

Any well written dice roller will give you perfect random rolls (well, pseudo-random — the difference doesn't matter for gaming).

Some dice rollers are not well written, or depend on the underlying OS/language's source of random numbers, which itself can be well written or not.

The vast majority of the time you will find dice rollers more random than actual dice, which, being physical objects, will be flawed.

I know of one product that had to change the library it used to generate rolls because the OS implementation was poor, but that is a rare case.

share|improve this answer
    
I agree with will find dice rollers more random then actual dice which [...] will be flawed but do keep in mind, that it is entirely possible to roll 5 1s in 8 rolls with real dice, which might not be possible in an app, because from my experience at least in video games, it is often desirable for the random number generators to provide a wide spectrum of results which have similar number of repeats. –  Maurycy Zarzycki May 23 at 6:21
    
A typical pRNG will be quite capable of generating a string of five repeats with very-nearly random probability. Yes, there comes a point where a pRNG algorithm will never generate a given number of repeats, which is theoretically possible for truly-random, but that point is higher than five. –  KRyan May 23 at 12:53
2  
There are some computer games which implement algorithms to make the results feel "more random" (by actually reducing the randomness, such as prohibiting long runs of the same result), but I would hope that dice rolling apps would not do that. –  Dave Sherohman May 23 at 13:28
    
@DaveSherohman There are surely some that do. As Bobby mentioned in the answer, some dice rollers are well-written, and some... not so much. There's more to being badly written than just mathematical and coding incompetence, there's also bad design choices, and as you point out, that's a popular one. A dice roller that does as you describe would be a very poorly written dice roller indeed, but I would be seriously surprised to find, out of all the dice rollers out there, that not one of their creators had made that particular bad decision. –  Matthew Najmon May 23 at 18:33

Are there any characteristics, qualities, or quirks of results obtained by using dice programs which might detract from play? Improve it?

Most modern computer-based random number generators produce good quality numbers, indistinguishable from truly random data. There are tests for this (e.g. the Dieharder test suite) that someone creating a low-level random number generator should use. Modern scripting languages - Ruby, Python etc - mostly use the Mersenne Twister algorithm by default, which is fast and passes these tests.

My, perhaps singular, peccadillo on this subject is the need to feel that "I" have somehow generated or contributed to the number. Too many generators in my opinion focus on the mechanics of "really random" and ignore the connection between a person and the dice they roll or cards they shuffle. In fact I have gone as far as creating a utility for that (a Ruby gem called "pool_of_entropy"), but not any usable service or application.

Are there dice programs which are below standard in their generation of reliable results? If so, can such results be recognized and assessed easily?

Some online rollers and randomising utilities unfortunately use older built-in rand() functions which are not so good. But a dedicated dice app should not (if the authors know anything about the subject).

Friends of mine who play WoW claim that the built-in roller they use in chat for deciding treasure allocation does not use a decent generator. I cannot substantiate that, but it would make sense - writers of tiny built-in utilities may well just reach for a language built-in rand(), which may be quite an old algorithm for older languages - such as C - purely for backwards-compatibility.

Recognising that a roller or utility is biased or low quality is quite hard - unless it is very obvious then you have to collect a lot of statistics, and even then it is not easy to tell when a sequence is not random, because random means "any sequence is in theory equally possible". Well said in this Dilbert cartoon.

share|improve this answer

A dice rolling program is only as good as the worst of:

  1. the random number return to die-sides algorithm
  2. the pseudo-random seed generator

Most are close enough to be better than dice.

Since computers can not generate truly random numbers, no die roller is truly random. The pseudorandom numbers, however can be sufficiently random enough to be more random than real dice.

A recent study found that most commercial d6 are biased significantly. The study had some flaws, but generally showed a bias for low numbers on most commercially produced d6's. (In one company's run, almost to the point of 1's being 2/7 of 1d6 rolls!) No individual batch tested showed a truly even distribution.

Some technical details...

There are two methods of random number return used in programming:

  1. A fractional return on a float or double-float (double). EG: 0.348826495
  2. A whole number return on an int or double-int (long). eg: 25565

given a fractional, the norm is to multiply the sides by the returned fraction, giving a fractional number between 0 and sides; round that down, getting an integer from 0 to sides-1, inclusive; then add 1, to get an integer from 1 to sides, inclusive. Due to both the nature of the fractions, has a slight bias, but it's effectively below resolution, on 16 bit machines. On some 8 bit machines using single precision, it has a notable bias on larger die types. The use of rounding routines also can affect this; the most common is a truncation, which is mathematically acceptable. §

Given an integer return, the normal mode is to perform a modulus operation (in American: find the remainder). Then add 1. 1+ ( Return modulus sides ). This introduces a very slight bias except for d4, d8, and d16. That bias is for LOW numbers, and is (maximum_return mod sides) / maximum_return. On 8 bit machines, with single precision integer returns, that's (256 mod sides)/256, for 0 for d4, d8, and d16, 1/64 for d6 and d10, 3/128 for d10, and 1/16 on d20. It's 7/32 for d100... on a 16 bit machine, with a long return (32bit integer), it's negligible for all dice below 10000 sides...

But, without looking at sources, the methods and return values can't be fairly evaluated.

The random number generation, however, varies WIDELY by OS, random number generation algorithm used, the random number seeding method, and even programming language used.

Bottom Line...

On newer machines with 16bit architectures, the skew is usually low, and slight. On 32bit machines, the skew is usually low, and miniscule. As long as you're using one for a 16 bit or newer machine, you should be as random as dice, if not more random.


§ the specification for the applesoft floating point routines written by Wozniak is for a 3 byte and 5 byte, using a single exponent byte, and 2 or 4 byte mantissa.

A typical (IEEE compliant) float these days is 4 bytes long, using a 24 bit signed mantissa (for ±2^23) range and an 8 bit exponent. As decimals output, the limit of precision is about 6 places. A double (double precision floating point) is 4 bytes, 53 signed mantissa and 11 exponent. Quadruple Precision is 8 bytes long with a 113 bit signed mantissa and 15 bit exponent, reliably giving 30+ place decimal accuracy. Note that in all three, the sign bit leads, then the exponent, then the mantissa. Quads are not routinely available yet.

share|improve this answer
    
Without examining the sources, you can't be certain. But in general, a die-roller is more fair than real dice. Tho' I noticed some serious fails in the Palm OS 3 system random. –  aramis Apr 13 '11 at 15:55

I also have tried to program several dice rollers in different languages, and usually the results seem to be random enough.

Other point is that by definition true randomness it's not really something you can verify but I agree that in general, most dice rolling programs can be as random or more than real dice.

share|improve this answer
2  
To be fair, you can verify it using normal statistical analysis, especially if you can code for bulk output of data. –  Brian Ballsun-Stanton Apr 18 '11 at 6:05
    
@BrianBallsun-Stanton actually, all that the stat analysis can prove is that it's not strongly biased - not that it's truly random. –  aramis Jun 14 '12 at 20:34
    
Granted. We can't "validate" within our normal space-time. Pragmatically, we can get good-enough results :) –  Brian Ballsun-Stanton Jun 14 '12 at 21:27
    
That's what I meant, you can't validate real randomness, but most of the dice rolling programs give good-enoguth results. –  pconcepcion Jun 15 '12 at 8:46

random.org produces random results by reading atmospheric changes, so that's about as truly random as you'd get. Doing tests on Random's Xd6 roller I haven't seen anything suggesting a bias - you can occasionally get some absurd results like with dice, but rolling habits don't come in. I know the biggest thing with rolling real dice for me is sometimes based on how I pick them up, and what height I roll them from, they keep repeating the same results, so I can get a good or bad streak going. This doesn't happen with random.org.

share|improve this answer
    
You shouldn't have to worry about their bit quota either, at 5 bits per d20, you could roll 40,000 a day before you hit the limit. Just figured I'd add this since I remembered they had one. –  ballesta25 Jun 7 at 5:08

One observation that I have had with dice rolling programs on the iPad/iPhone is that there seem to be "cheat" settings allowing the user to bias rolls to be higher (or lower) than expected.

If you are doing online gaming and the players and the GM are all using a die rolled in a virtual game table or the like, then you probably don't need to worry about this, but if you are thinking of players using die rollers on their phones while playing face to face, this could become an issue.

share|improve this answer
5  
On the other hand, if you can't trust your gaming group, you shouldn't be playing with them. –  Brian Ballsun-Stanton Apr 18 '11 at 6:07
    
@brian, true, but sometimes it's nicer to not have to, or players could be fiddling with the rollers and honestly forget. It's a consideration, and nothing more. –  Simon Withers Apr 20 '11 at 1:34

I tend to write a simple dice roller as the first program I create when I'm working with a new programming language.

I create it so that you can roll xDy, and I also always put in a method that will roll 1D100 10,000 times (it's really not that slow on modern machines) and do some simple stats on the outcome.

In general, I've found that MOST languages (on Windows OS) tend to generate a fairly consistent spread over the 100 numbers across 10,000 rolls. It IS, however, possible for any pseudo-random number generator to fall into a predictable pattern, if poorly implemented. My methodology doesn't check for that.

share|improve this answer

Computers and their kin are deterministic machines. They have no way for generating a pure aleatory variable.

However, there are a lot of very good pseudo-random number generation algorithms that generates a sequence of numbers where the correlation between a number and the next is so weird that a human being is unable to discern a pattern.
These algorithms usually start from a seed number. Being deterministic, the same seed produces always the same sequence of numbers. To circumvent this problem, the seed is usually made time-dependent, so that a user could introduce a true aleatory component (the moment at which he invokes the die rolling).

Basically, there could be differences among dice-rolling tools according to the algorithm they implement. However, these differences are not noticeable by a human observer nor relevant on the small number of rolls and the narrow space of possible results that are usually involved in a role-playing session (they may start to be relevant on large scale statistical analysis or simulations).

I think that some dice could be less reliable than most pseudo-random generators because of physical production defects in their weighting.

share|improve this answer
7  
Not quite. There are pure-random input sources possible, but they're generally not necessary for the level of RNGs needed in dice-rolling apps. –  Brian Ballsun-Stanton Apr 12 '11 at 7:12
5  
True, but they have dedicated hardware that monitors a physical random event. A computational machine has no way for generating pure randomness. –  Erik Burigo Apr 12 '11 at 7:27
2  
Exactly. Furthermore, on the small amount of numbers usually involved in the role-playing activity, even a computed analysis could be unable to tell the difference. –  Erik Burigo Apr 12 '11 at 10:26
3  
Actually, one of the most random elements around is commonly used as a seed value - the time of initialization of the the RNG instance for the program, and then for many, especially useful for human triggered ones, the time between calls upon the RNG. Given the measurement precision, and the human action imprecision, that's as close to a brownian source as you need for near true random. –  aramis May 23 at 0:11
3  
Time, mouse movements, audio input, timing of hard disk accesses: every modern computer has dozens of ways to "monitor physical random events" without specialized, dedicated hardware. –  Russell Borogove May 23 at 1:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.