How to roll an imaginary 6-sided die in your head

Originally published at:


Wouldn’t it be easier to just do mod(N,6) instead of mod(N,9) and then having to throw out 1/3 of your calculations?

Also to be pedantic, even if the words you use for this are truly selected at random, the resulting numbers wouldn’t pass the chi-squared test because the distribution of letters in words is not random.


On your first statement, that’s what I came here to post😀. Second point is an interesting observation, though pedantry aside, these are probably good enough for random-numbers-in-your-head-while-driving.

1 Like

I’m sure I have some real dice kicking around here somewhere…


I think that might be part of what the mod(N,9) is trying to work around.

Alright, we have our cool mental tool, let’s sum the top three rolls of 5d6! Done? Great, now it’s dinnertime.

Pretty sure that’s what fuzzy dice were invented for: 2d6 emergencies while driving.


It’s probably mod 9 because it’s easy in your head, just add the digits together, and keep doing it until you get a single digit. Treat a 9 as 0.

I just ran this with /usr/share/dict/words on my system, and got this distribution:

1 53701
2 53358
3 53251
4 53035
5 53145
6 53241

I don’t have a common word list handy, I’d imagine it’d be worse for those and the distribution with which they might occur to you.


Book co-author here. Also, the shortcut procedure of “casting out nines” as described is much easier for most people (in my experience) than calculating mod 6, and you get the ability to roll d100 / percentile dice as a bonus, as well as d-anything-less-than-10.


To be even more pedantic, it would be interesting to know just how “weighted” (towards which rolls, and by how much) random short words are.

1 Like

Interesting. I did the mod9 with skip also from the book, and also the simpler mod6 and I see:

N1 6=39264 9=26364
N2 6=39458 9=26244
N3 6=39676 9=26164
N4 6=39094 9=26061
N5 6=39309 9=26233
N6 6=39085 9=26092

So #1 apparently I have a far smaller dictionary, and #2 the results skew less in mine, but my 4 result is the least common, followed closely by the 6. Yours is 4, 5, 6.

At any rate with any of these methods and either dictionary the result counts differ by a small number of 100s out of tens of thousands. So not too bad, but if money or lives are in the line with the random numbers you could get a very very small edge…


Oh, also if anyone has a hankering to try on their own word list and happens to have Perl, help yourself:


my %h9 = ();
my %h6 = ();

while(<>) {
    my(@letters) = split(//, $_);
    my $t = 0;
    my($t9, $t6);
    for $l (@letters) {
            my $n = ord(uc($l)) - 64;
            $t += $n;
            $t6 = 1 + $t % 6;
            $t9 = $t % 9;
            if ($t9 == 0 || $t9 == 7 || $t9 == 8) {
                    $t9 = "SKIP";
    print "$_:$t6:$t9\n";
    $h9{$t9} += 1;
    $h6{$t6} += 1;


for $k (sort keys %h6) {
print “N$k 6=”, $h6{$k}, " 9=", $h9{$k}, “\n”;


Well, ya know the problem : if you can think of the word, it’s not random.

Also, cue up Rush’s “Free Will”


Awww. . . I gotta do math??


Since it’s imaginary, it’s easier if you imagine it weighted.

1 Like

Book co-author here. If you read carefully, the hack only claims to generate pseudorandom numbers. You don’t have to use words you think of, though. For a better distribution, try something like the third word on the next billboard you see.


It’s not random if it comes out of a machine.

1 Like

Are you allowed to have a Perl program that doesn’t look like line noise? Surely that violates the spirit of Perl, if not the regulations :-).

I have great respect for Perl programmers, but for me, it’s too much like strapping an unlicensed nuclear accelerator to your back. Very powerful, but cross the beams and every molecule of your program explodes outward at the speed of light…

I also just realized how much the term “line noise” dates me. :-(.


Flip a coin three times.

I don’t mind recycling of articles. But shouldn’t this be noted somewhere? Something like “first published on September 6th, 2011”? Just thinking out loud.


I asked my craps dealer if he’d trust me that the numbers I was imagining in my head were randomly generated.

No dice.