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

Filter by
Sorted by
Tagged with
7
votes
2answers
138 views

How to pass multiple random numbers (generated using lcg package) to a macro?

Inspired from this answer I would like to generate a multi-digit addend using some random numbers. I can generate the random numbers, but I'm unable to use them properly (Tex capacity exceeded). Here ...
0
votes
1answer
61 views

Number section-LaTex

How Can I change the format number section, subsection, and subsubsection? The document put: Section (I.) Subsection (I.1) Subsubsection (I.1.1) But... I want: Section (I.) Subsection (1.1) ...
3
votes
2answers
111 views

How can I assign unique numbers, or a sequence, in LaTeX?

I'm trying to make flashcards to export to Anki, a flashcard program. I'm using the following link: http://reh.math.uni-duesseldorf.de/~zibrowius/LatexNoteImporter/ I'd like to assign each card with ...
2
votes
2answers
38 views

switch string/commands based on “random” values to produce random cards

Update Or is there a way to generate random number between 1 and 52 using lcg package, then associate it to one of the 52 cards from the pst-poker package. Which might be easier to achieve? OP ...
2
votes
2answers
44 views

tabular environment with random positions

I would like to simulate a simple random cloud of letters using a custom tabular environment, like this: \documentclass{article} \usepackage{lcg} \begin{document} \reinitrand[first=12,last=20,...
3
votes
4answers
416 views

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 ...
1
vote
2answers
88 views

How to create a subtraction worksheet with random numbers in each question?

I would like to create a worksheet which looks like the following: Here instead of manually typing every question, I would like to create random questions, where the subtrahend is from a set of ...
1
vote
0answers
34 views

randomizer/anti-cheating question generator [duplicate]

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

creating random question paper using probsoln package

I have written code for generating random questions using Probson package. The only problem I face is that It shows the same output again and again when I run the Program. What I want is whenver I ...
1
vote
1answer
73 views

Evenly distributed random non-stops

I am trying again to recreate some strange images. I am trying to generate hexagons of nonstop with three colors. The distribution of these three should be Color 1 = (N-1)^2 Color 2 = (N-1)*N Color 3 ...
2
votes
2answers
110 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
123 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
81 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
2k 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
402 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
150 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
50 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 ...
4
votes
1answer
377 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
397 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
186 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
134 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
706 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
104 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
51 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
383 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
444 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
144 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
386 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
154 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
432 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
469 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
65 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
522 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
53 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
185 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
248 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
631 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
155 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
38 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
272 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
95 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
1k 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
311 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
1k 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 ...
4
votes
3answers
204 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
127 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
67 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
3k 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
187 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
551 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 ...