You can use the background
package to put things on every page, the rest is done by TikZ:
Code
\documentclass{scrartcl}
\usepackage[margin=25mm]{geometry}
\usepackage{background}
\usepackage{lipsum}
\usetikzlibrary{calc,shapes.geometric}
\backgroundsetup%
{ contents=%
{ \begin{tikzpicture}
[ overlay,
remember picture,
wx/.style={draw,regular polygon, minimum size=1.5cm, above,fill=red!10,thick},
w4820/.style={wx, regular polygon sides=3},
w6/.style={wx, regular polygon sides=4},
w12/.style={wx, regular polygon sides=5},
w10/.style={wx, kite,kite vertex angles=100 and 60,minimum size=1cm},
line join=round,
]
\node[w4820] at ($(current page.north west)+(4,-2)$) {\pgfmathparse{random(1,4)}\pgfmathresult};
\node[w6] at ($(current page.north west)+(6,-2)$) {\pgfmathparse{random(1,6)}\pgfmathresult};
\node[w4820] at ($(current page.north west)+(8,-2)$) {\pgfmathparse{random(1,8)}\pgfmathresult};
\node[w10] at ($(current page.north west)+(10,-2)$) {\pgfmathparse{random(1,10)}\pgfmathresult};
\node[w12] at ($(current page.north west)+(12,-2)$) {\pgfmathparse{random(1,12)}\pgfmathresult};
\node[w4820] at ($(current page.north west)+(14,-2)$) {\pgfmathparse{random(1,20)}\pgfmathresult};
\end{tikzpicture}
},
color=black,
angle=0,
scale=1,
opacity=1,
}
\begin{document}
\lipsum[1-100]
\end{document}
Output

Edit 1
Here's finally an automatic version. It checks the total number of pages, and then draws the dices, the values equally distributed, and does not draw any further if there's no more room for an other set.
The dices are supposed to be, from left to right, d4, d6, d8, d10,d12 and d20.
As it turns out, most d10 of people I know actually use the "inverted" kite.
To use different dice, just change the values in the for lop in \setinitialdicevalues
, e.g. \foreach \x [count=\c] in {6,10,12,20,24,30}
and provide fitting syles in the tikzpicture
, e.g. add stlyes w24
and w30
Code
\documentclass{scrartcl}
\usepackage[margin=25mm]{geometry}
\usepackage{background}
\usepackage{lipsum}
\usepackage{xstring}
\usepackage{xifthen}
\usetikzlibrary{calc,shapes.geometric}
\usepackage{totcount}
\regtotcounter{page}
\newcommand{\setinitialdicevalues}
{ \xdef\dicedata{+}
\foreach \x [count=\c] in {4,6,8,10,12,20}
{ \pgfmathtruncatemacro{\maxsets}{(\totvalue{page}-1)/\x}
\pgfmathtruncatemacro{\maxpage}{\maxsets*\x}
\xdef\mytemplist{,}
\ifthenelse{\maxsets > 0}
{ \foreach \y in {1,...,\maxpage}
{ \pgfmathtruncatemacro{\mytempvalue}{mod(\y-1,\x)+1}
\xdef\mytemplist{\mytemplist\mytempvalue,}
}
\xdef\myrandomlist{,}
\foreach \y in {\maxpage,...,1}
{ \pgfmathtruncatemacro{\nei}{random(1,\y)}
\pgfmathtruncatemacro{\neipo}{\nei+1}
\StrBetween[\nei,\neipo]{\mytemplist}{,}{,}[\nextelement]
\StrSubstitute[1]{\mytemplist}{,\nextelement,}{,}[\mytemplisttwo]
\xdef\mytemplist{\mytemplisttwo}
\xdef\myrandomlist{\myrandomlist\nextelement,}
}
\xdef\dicedata{\dicedata\maxpage+\myrandomlist+}
}
{ \xdef\dicedata{\dicedata0++}
}
}
\typeout{\dicedata}
}
\newcommand{\getdicelist}[1]%
{ \pgfmathtruncatemacro{\lowerindex}{2*#1}%
\pgfmathtruncatemacro{\upperindex}{2*#1+1}%
\StrBetween[\lowerindex,\upperindex]{\dicedata}{+}{+}[\mytempdata]%
\xdef\currentdicelist{\mytempdata}%
}
\backgroundsetup%
{ contents=%
{ \begin{tikzpicture}
[ overlay,
remember picture,
wx/.style={draw, minimum size=1.5cm, above,fill=red,font=\bfseries\selectfont,text=white,rounded corners=0.5mm,inner sep=1pt},
w4/.style={wx, regular polygon, regular polygon sides=3},
w6/.style={wx, regular polygon, regular polygon sides=4},
w8/.style={w4},
w10/.style={wx, kite,kite vertex angles=100 and 60,minimum size=1cm,shape border rotate=180},
w12/.style={wx, regular polygon, regular polygon sides=5},
w20/.style={w4},
]
\foreach \x [count=\c] in {4,6,8,10,12,20}
{ \pgfmathtruncatemacro{\lowerindex}{2*\c-1}
\pgfmathtruncatemacro{\upperindex}{2*\c}
\StrBetween[\lowerindex,\upperindex]{\dicedata}{+}{+}[\currentlastpage]%
\pgfmathtruncatemacro{\firstemptypage}{\currentlastpage+1}
\ifthenelse{\value{page} < \firstemptypage}
{ \pgfmathtruncatemacro{\lowerindex}{2*\c}%
\pgfmathtruncatemacro{\upperindex}{2*\c+1}%
\StrBetween[\lowerindex,\upperindex]{\dicedata}{+}{+}[\currentdicelist]%
\StrBetween[1,2]{\currentdicelist}{,}{,}[\mynextnumber]
\node[w\x] at ($(current page.north west)+(2+2*\c,-2)$) {\mynextnumber};
\StrSubstitute[1]{\currentdicelist}{,\mynextnumber,}{,}[\mytempdicelist]
\StrSubstitute[1]{\dicedata}{+\currentdicelist+}{+\mytempdicelist+}[\mytempdicedata]
\xdef\dicedata{\mytempdicedata}
%\node[w\x] at ($(current page.north west)+(2+2*\c,-2)$) {\pgfmathparse{random(1,\x)}\pgfmathresult};
}
{
}
}
\end{tikzpicture}
},
color=black,
angle=0,
scale=1,
opacity=1,
}
\AtBeginDocument{\setinitialdicevalues\par\bigskip}
\begin{document}
total pages: \pgfmathparse{int(\totvalue{page}-1)}\pgfmathresult\bigskip
\lipsum[1-100]
\lipsum[1-100]
\lipsum[1-60]
\end{document}
Output
This is page 31 of 37. So we see d4, d6, d8 and d12, but not d10 (last on page 30) or d20 (last on page 20).

lastpage
/pageslts
). 2. Calculate the needed dices and their amount (any math package would probably do, something with a mod function, and can be done with plain TeX counts). 3. “Draw” the dices (TikZ, PSTricks, etc.), for d6 exist even a few packages that provides simple symbols. 4. Add the (possible randomized drawing) to every page:everypage
,everyshi
, …