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}.

2
votes
2answers
81 views

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 ...
4
votes
1answer
73 views

Random Numbers and Variables in Latex

Below is my MWE. I understand the gist of tikz and foreachs, but when it comes to variables I don't understand most yet. I want an arrow pointing from each cell to a module, and them from the module ...
1
vote
2answers
60 views

Add a randomly generated number to a latex document to discourage cheating on an exam

I am trying to cut down on a particular kind of cheating during my in-class exams. What some students are doing is taking pictures of the exam (while I am looking somewhere else), and uploading them ...
16
votes
2answers
1k views

Drawing a constant randomly distorted circle

I am trying to draw a special and contradictive plot : A circle with random distortions which have to remain constant regardless of how many times I build the document. An example of what I am trying ...
2
votes
2answers
383 views

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 ...
2
votes
1answer
116 views

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. \...
1
vote
0answers
39 views

“Esami” package: random extraction from a set of elements?

I am trying to give randomness to a test with the "esami" package and the command "randestrai" was promising. I wanted to pick some random prime numbers so I wrote \randestrai{3,5,7,11}{alpha} which ...
3
votes
1answer
242 views

Tikz picture using random number

I am using currently tikz to describe a law used in a Theory. This method describes the construction of sub-Area by breaking point in different lines. I want to reproduce this picture: In this one, ...
9
votes
1answer
300 views

Random points in a rectangle

I have made a graph as shown in the following figure: For each rectangle I'd like to generate n random points in it, is it possible? My code: \begin{tikzpicture} \begin{axis}[ grid=major, ...
1
vote
2answers
137 views

Help with writing base 10 addition/subtraction formula

I am preparing this small tutorial for addition and subtraction formulas for kids who have a strong understanding of base-10 representation and also have a good enough understanding of addition and ...
4
votes
1answer
127 views

\lipsum redefinition doesn't expand well with lcg random integer

I'd like to redefine the \lipsum command provided by the lipsum package such that \lipsum{} outputs not a predefined amount of lorem ipsum paragraphs, but a single, random, lorem ipsum paragraph (that ...
4
votes
1answer
696 views

3.33333pt at the top of the document

I am currently attempting to write my first Latex document and having some issues with it. There is a weird 3.33333pt at the top of the document, as can be seen in the attached image, and it will not ...
1
vote
0answers
86 views

Creating Brownian Motion graph and labeling dW

I've found code to create the Brownian motion graph - \newcommand{\Emmett}[5]{% points, advance, rand factor, options, end label \draw[#4] (0,0) \foreach \x in {1,...,#1} { -- ++(#2,rand*#3) } ...
2
votes
2answers
46 views

PGF macro to map value to a different interval

I'm trying to write a macro to be used with random generators (in particular rnd) within Tikz, to map numbers to different intervals. [0, 1] ---> [a, b] f(x) = x*(b-a) + a What I tried so far is:...
2
votes
1answer
253 views

PGF/Tikz: Random seed set to same number, getting different outputs in different contexts

I am trying to create a random walk (as a substitute for a true Brownian motion) which starts and ends at 0. I generate the random walk using random numbers for each step, and the standard way of ...
0
votes
2answers
351 views

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: ...
2
votes
0answers
109 views

Calling pgf rand inside pgfmathsetmacro creates extra text

I am using pgf and tikz for some latex questions. The code below illustrates a problem I am facing: when I use the rand function from pgf inside a pgfmathsetmacro I get some extra text at the ...
3
votes
1answer
292 views

PGF Dimension too large

I am trying to create mental math worksheets that extend math facts from 6*7=___ to something like 6*700000=_________. Apparently, though PGF and/or TeX cannot handle numbers bigger than around ...
3
votes
1answer
94 views

Why Are My Random List Items Always Identical? [duplicate]

I have a list and then two randomly selected items from them. But those two items are always the same. Why? \documentclass{article} \usepackage{pgf} \usepackage{pgffor} \pgfmathsetseed{\number\...
2
votes
1answer
346 views

Randomize Enumerate but fix one entry

I'm looking to randomize the order of enumerate items (which I know has a solution), but I'm also looking to fix one of the entries. In other words, I want to randomize the numbers 1-10, but have 6 be ...
3
votes
1answer
352 views

Is it possible to generate random numbers dynamically with javascript on a PDF?

PDFs can be used to manage javascript, such as the packages ocgtools, ocg-p, ocgx or ocgx2, which allow you to create interactive and clickable PDFs. The hyperref package allows you to insert URLs or ...
2
votes
1answer
58 views

How do things like ToC and label work to save information between compiles?

I have some code that generates some random content. I would like to add the ability to use the last-results instead of generating new random values. The way I thought to do this would be to 'save' ...
4
votes
2answers
388 views

Random Permutations of List Items

I am creating worksheets for the unit circle and special triangles. It is easy to make a list of those angles and then randomly print one of them at a time an arbitrary number of times. That code is ...
2
votes
1answer
50 views

How to convert current 'state' of machine after having produced pdf using rand-containing coordinates into deterministic TikZ code reproducing it?

Question. In TikZ, if using coordinates of the form (x,y)+(0.5*rand,0.5*rand), is it possible to recover the coordinates that were used to produce the pdf in the very last compilation one did? ...
3
votes
1answer
160 views

“Roll” random dice in footers, like in bookgames

I am playing with the gamebook package which allows to recreate the look and feel of gamebooks in LaTeX. Many of these books had a couple of d6 dice at the bottom of each page, so that the reader ...
3
votes
1answer
226 views

Convert Random \frac{a}{b} to Float? Is the question phrased properly?

How do I convert a randomly selected fraction in the [string?] form \frac{a}{b} to a [float?] form so that pgf can do calculations with it? I am creating an exercise in which students practice ...
6
votes
3answers
506 views

How to Create Random Letter?

I am trying to create algebra quizzes which are generated by random numbers and each exercise's variable is a random letter from the alphabet. I think I can do the random numbers. Not sure how to do ...
2
votes
2answers
143 views

Pair of Random Numbers without Common Factors

My goal is to define \avar and \bvar such that they are integers between 1 and 11 inclusively but share no common factors and they should never be equal. I think that the code I've written should do ...
2
votes
1answer
33 views

Missing Variables

In this code, I've created three lists of random numbers... but for some reason, they only show up some of the time. What's happening? \documentclass{article} \usepackage{pgf} \usepackage{pgffor} \...
3
votes
2answers
187 views

Randomly sample string from list of string in a foreach

I have a list of strings {happiness, only, real, when, shared} and would like to sample from this list inside a \foreach. Even though this is a very simple problem, I can't find any solution online. ...
0
votes
1answer
86 views

Random Lists, Not Compiling

I am trying to create a macro that can generate complex trinomials. What I've made compiles as desired about 80% of the time and gives me a whole bunch of error messages about 20% of the time. You ...
6
votes
4answers
940 views

Setting up a quadratic-equation factoring worksheet: How to get rid of unwanted zeroes & ones?

I am in the midst of my second attempt to create basic high school factoring worksheets. Next up is figuring out how to reject unwanted zeroes and ones. The following code generates simple trinomial ...
1
vote
2answers
254 views

Random Variables that I can call in latex Beamer

I am creating slides in latex beamer for use with clicker questions. On each question I would like the numbers to be randomly changed every time I compile, however I want to be able to call the ...
12
votes
3answers
982 views

Random Page Numbers

I need some help with a crazy idea. For a book I want the page numbers to be a random permutation. As an example, if the book would have 5 pages, I want something like (4,1,2,5,3). Optimally, the ...
3
votes
3answers
184 views

How to create multipage tables of binary arithmetical problems (and associated answers) involving pseudo-random numbers?

Consider the following example: \documentclass[ a4paper, landscape, 12pt ]{article} \usepackage[sc]{mathpazo} \usepackage[ hmargin = 4cm, tmargin = 1.5cm ]{geometry} \usepackage{fancyhdr} \...
2
votes
2answers
101 views

Single-Digit xlop exercises

I am creating worksheets for young children in which they'll be doing single digit operations vertically. How do I set them up vertically so that there is: An exercise worksheet with no answers. A ...
2
votes
2answers
58 views

Single Digit Sums; “Missing Number Treated as Zero”

I am trying to create a worksheet in which students practice adding single digits. Since sums 10 or greater are more difficult, I want corresponding questions to occur more often. This doesn't ...
13
votes
5answers
2k views

How to Obtain a Random Non-Zero Integer?

I would like \a to generate a random non-zero integer between, say, -5 and 5 inclusively. One way to do this would be to make a list of all integers from -5 to 5 but excluding zero, then drawing ...
1
vote
1answer
152 views

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 ...
2
votes
2answers
467 views

GCD and Polynomials

Is there a simple command to find the greatest common divisor (GCD) of any set of terms? I am trying to use random numbers to generate complex trinomials of the form ax^2+bx+c such that a,b,c are all ...
1
vote
1answer
223 views

Custom functions & random numbers for nonlinear colourmaps in PGFPlots

I'm trying to create a figure similar to figure 1 of this paper. I know how to make a cylinder with PGFPlots, but I'm new to 3D plots and I haven't mastered the art of colourmaps yet (and several ...
7
votes
4answers
286 views

Random integers with differing probabilities

This is a follow-up to my last post on random numbers. My new question is: Say I want \n to generated (kind of) randomly, such that \n=1 10% of the time \n=2 20% of the time \n=3 30% of the ...
10
votes
6answers
2k views

Pick Randomly Between -1 or 1

I would like to generate a simple macro to make \x either 1 or -1. But I'm not sure how to do that. I set up the code below, but I believe it randomly chooses between -1, 0, and 1. What adjustment ...
0
votes
1answer
69 views

Macro with Random Number Not Working

I am attempting to create math fact worksheets for kids to practice, say, 2+3=5, but in every form of that equation: 2+3=_ _ _ 2+_ _ _=5 _ _ _+3=5 _ _ _=2+3 5=_ _ _+3 5=2+_ _ _ I would like ...
2
votes
1answer
268 views

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=...
2
votes
1answer
85 views

Random Negatives Integers in Basic Factoring

I am trying to create a basic factoring worksheet with random numbers. So far, it's pretty easy if all integers are positive. That is, it's easy to create x^2+10x+24=(x+6)(x+4) with random numbers. ...
2
votes
1answer
179 views

random numbers scaled into parametrized intervals

MOTIVATION: To point shade a diagram. Points have random coordinates. They cluster around hidden user input coordinates more or less far out depending on those inputs. How would one use \...
1
vote
2answers
216 views

Why did my \xdef fail?

Building upon what I was doing in this thread, why didn't my \xdef work? The Exercise Page comes out just fine. Ideally, the Answer Page would look identical, except, of course with the answers ...
1
vote
1answer
175 views

Make Exercise/Answer Tables Correspond

How do I set this up so that when the random numbers generate the exercises, they also automatically generate the answers for the answer table? Do I need to revamp the whole thing or can I make a ...
16
votes
4answers
2k views

How can one create a random GUID?

GUIDs (or Globally Unique Identifier) are usually stored as 128-bit values, and are commonly displayed as 32 hexadecimal digits with groups separated by hyphens, such as: 21EC2020-3AEA-4069-A2DD-...