I'm trying to generate a "word cloud" by using \mboxes with random spaces around words.
In the code below I've removed stuff that change the font size, and I've replaced \mboxes by \frameboxes for debug purpose.
\documentclass{article}
\usepackage[first=1, last=10]{lcg}
\newcommand*{\wordtag}[1]{%
\framebox{\vspace{3pt}\hspace{5pt}#1\vspace{1pt}\hspace{6pt}}%
}
\begin{document}
\rand
\wordtag{color}
\wordtag{animals}
\end{document}
When I replace length with \rand (i.e. \vspace{\rand pt}), I get the following error:
! Illegal unit of measure (pt inserted).
Does anyone know how to fix this error?
And why the \rand at the beginning of the document doesn't print anything?
Is there a better way to produce a word cloud?