Questions tagged [random-numbers]

about the production of document elements involving the creation of random numbers. Affiliated tags could be {tikz-pgf}, {tables}, {letter}, {fonts}.

{random-numbers} questiona are about the production of document elements involving the creation of random numbers. This might be accomplished in LaTeX itself (e.g. using PGFs mathematical facilities) or embedded Lua-code or even an external script.

Meaningful showcases are the following posts:

183 questions
25
votes
8 answers

How to create a random math problem in LaTeX?

I want to create a math problem-solution sheet. The coefficients a, b, c must be assigned on the fly at random so the generated pdf will show a numeric quadratic equation rather than a symbolic quadratic equation. Note a must not be…
Display Name
  • 46,933
17
votes
3 answers

Generating random numbers without repetitions

How do I generate in LaTeX a list of random integers, in a given range, avoiding repetitions? The command \pgfmathrandomitem selects an item from a list, but when inserted in a loop can select twice the same item. Since I am selecting questions from…
8
votes
4 answers

How to get a random number within a range?

How can I return a random number within a range? Here is a minimal (non-)working example of what I'm after: \documentclass{article} \newcommand{\thecmd}[1]{ % todo, set a to: #1-(#1/4) % todo, set b to:…
6
votes
3 answers

Random form letter text

I want to randomize some of the text contained within some letters. For e.g.: \random{Dear \name,}{Hello \name,}{Greetings \name,}{Hi \name,}{To \name,} \random{You are invited to}{You are welcome to}{I would like to invite you to}{This is an…
Village
  • 13,603
  • 23
  • 116
  • 219
6
votes
0 answers

Problem generating a random worksheet

I've been trying to adapt the steps given here. how-to-generate-random-variables-then-use-in-calculations-in-pdflatex My MWE is below (and I apologise for the code being a bit…
bbujeya
  • 611
3
votes
2 answers

Random numbers and if statements

I want to produce a random number and with this check an if statement. But it does not work. I tried the following: \documentclass{minimal} \usepackage[first=0,…
Timo
  • 31
3
votes
1 answer

Somewhat(?) Random Numbers?

I'm making an built with random numbers, that is effectively guessing and checking to solve systems such as: mn=-10 m+n=3 where m and n are random integers. Strangely, I notice no cases where m+n=0, except when m=n=0. I've recompiled quite a few…
2
votes
2 answers

How to randomize entries of a table?

Consider the following code. Is such a randomization possible? I have many different tables where the number of letters may vary from table to table. However, within each table, the letters correspond always to the first letters of the alphabet.…
PaulS
  • 461
2
votes
2 answers

How can I duplicate a random number in two places on the same page in a latex editor?

I am trying to create a mental math practice sheet generator in a latex editor. For the number of questions intended, I require only half of A4 sheet. So the other half I want to print the same set of questions for another student. In excel we can…
rhlchd
  • 21
2
votes
1 answer

Least common multiple of many numbers

I need to make visualization like this: In this case we have 3 numbers I need to make it with 2 or 3. It will be very good if it looks like this - here we have denominating only 1 number. \documentclass{article} \newenvironment{denom}{% …
Simeon Simeonov
  • 819
  • 5
  • 11
1
vote
0 answers

randomizer/anti-cheating question generator

It is a rather common practice that teachers prepare multiple versions of a test for the same exam in order to reduce cheating. Can \LaTeX do this? I want to design a math test with a set of parameters that are randomly chosen from a given set to…
Maesumi
  • 9,059
1
vote
1 answer

Prune list for random order without repetition problem

I use prune list command from this tutorial Generating random numbers without repetitions for avoid repetitions while generate random sequence. But if I try to use this command in framed box, for example, it doesn't work. As well as in minipage…
0
votes
2 answers

How to generate an unique hexadecimal hash from a string?

Is it possible to generate a unique hexadecimal hash from a string in LaTeX? It does not have to be cryptographic, so it doesn't matter if it is reversible. For example: input: 2018013001 output: 78486F49 To explain my usecase: I would like to…
user5950
  • 1,456