A random generator might come in handy at some point. The lcg package provides exactly that.
All you have to do is load the package with options if needed.
\usepackage[option1, option2, ...]{lcg}
Available options:
first
: lower bound (
last
: upper bound (
counter
: name of the random number (overwritten if existing),
seed
: starting value for reproducibility, and
quiet
: suppress log and console output.
Without specifying boundaries, a random number will be generated in the interval
The \rand
command produces a new random number and \arabic{rand}
writes the number to the document, assuming you are using the default counter name “rand”.
Example code for a random number between -100 and 100. The code also defines the macro random
for simplification.
\usepackage[first=-100, last=100]{lcg} \newcommand{\random}{\rand\arabic{rand}} ... \random
Similarly, roman
random numbers can be generated using \roman{rand}
instead of \arabic{rand}
.
You can find the package as well as the documentation here.