Skip to main content

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
0 votes
2 answers
103 views

Command for a comma-separated list of 'Nchoose' numbers from '1,2,...,Nmax' numbers

I found a code here from @John Kormylo that chooses \Nchoose numbers from 1,2,...,\Nmax numbers and give it out as comma-separatet \mylist. Question: How could I make a command from this, like \...
cis's user avatar
  • 8,912
2 votes
1 answer
53 views

Repeat same random number

Answering this question: Draw illustration in tikz , I wanted to draw a non-intersecting stepwise (super-)ellipse with random modified radius. I ended up using essential this: \documentclass[tikz, ...
hpekristiansen's user avatar
0 votes
0 answers
28 views

Prevent recalculation of random numbers between frames [duplicate]

In a beamer presentation, I am generating a schematic that involves some randomness by using rand to calculate coordinates. Code: \begin{tikzpicture}[scale=1.5] \draw[fill=blue!20] (-3,0) ...
user2751530's user avatar
  • 1,102
4 votes
1 answer
94 views

Draw a second line on a graph which is a reflection of a randomly generated one

I'm having a problem with drawing a sample path of a standard Brownian motion process showing the reflection property. At the point where the red dashed line and the blue line meet I would like to ...
VlakecTomaz's user avatar
0 votes
1 answer
135 views

Poisson distribution simulation [closed]

Simple question : how does one simulate a Poisson distribution ? And preferably, in a way compatible with the use of tikz (the goal is to automatically plot a random number of points in a given area). ...
20-sided-dice's user avatar
4 votes
1 answer
157 views

How to include EPS in LuaLaTeX multiple times and have the postscript code run each time?

Ahoj, I have an .eps file that does some random number calculations in order to look different on each execution. Now I want to include it into a LuaLaTeX document several times, and each time it is ...
Golar Ramblar's user avatar
4 votes
1 answer
126 views

Dynamically generate values in matrix and calculate using them

I am using the following code to generate a matrix filled with random values. I would like to use this matrix to explain how a convolution is applied to an image (specifically the mean), so that's ...
Dexterous's user avatar
5 votes
1 answer
274 views

Access cryptographic secure random generator

I am writing my Master's Thesis in cryptography at the moment. The main part deals with randomness; therefore, I wanted to make a little Tikz picture in the introduction to show an example of ...
Titanlord's user avatar
  • 541
0 votes
2 answers
206 views

How to type cancel to with a line not an arrow

I want to use cancel to but with just a line instead of an arrow
Mahmoud Tabasi's user avatar
1 vote
0 answers
88 views

Random numbers and further usage

I am designing random excercise sheets for my students. I'm able to get random numbers without repetition using the code from Random number without repetition in an \includegraphics. Now I want to use ...
nurmiUBT's user avatar
0 votes
3 answers
311 views

Random generator for exam class in Physics or Chemistry

I would like to create a exam class such as: I could include random generator of both numbers and units for conversion factors in physics and chemistry. In particular, what I wish is a pseudorandom ...
riemannium's user avatar
1 vote
1 answer
47 views

Overriding nimsticks package not working as desired

nimsticks is a package that makes drawing nim games easier. For example \nimgame{5,3,4} generates three piles of 5,3,4 sticks respectively. \documentclass{article} \usepackage[utf8]{inputenc} \...
stank2196's user avatar
1 vote
1 answer
190 views

creating random numbers in a tikz diagram for use in a formula

I would like to create a worksheet similar to this https://pastebin.com/fSuS4C9f but for circumferences of circles not to bothered about the answers section at the moment but I can't even get the ...
Paul A's user avatar
  • 1,117
0 votes
1 answer
175 views

A printing quarry

I know this is not a type setting issue, but if anybody could help with directing me to a site that could help or advise me what type of language I need to learn in order for me to do what I want...I ...
Paul A's user avatar
  • 1,117
1 vote
2 answers
35 views

How to stop Beamer \only overlay regenerating random parameters on parts of frame previously rendered

I have some lcg randomisation in a frame that uses \only. My problem is that the multiple PDF pages that are supposed to make the parts of the frame look like they are slowly appearing next to what ...
Peter Rowlett's user avatar
0 votes
2 answers
217 views

specify a range using random numbers

I am using the following code to illustrate double angle theorem and although it works some of the time, I world like a method to define the random numbers so it always takes the form, as shown in the ...
Paul A's user avatar
  • 1,117
0 votes
0 answers
363 views

Worksheet generator with random numbers

I would like to implement a worksheet generator in Latex with the following features: It should contain commands to generate addition, subtraction, multiplication and division exercises with random ...
nrf52840's user avatar
2 votes
1 answer
372 views

How to set specific seed for random number generator in expl3 for use with xfp

I am using the xfp package to generate some random numbers, and am trying to figure out how to specify a specific random seed for the pseudo random number generator (so it gives the same results ...
Bob's user avatar
  • 125
5 votes
2 answers
423 views

Evaluating expressions using xfp

I want to generate two integer random numbers for the radius (r) and heigth (h) of a cilinder, in a certain question of my exam. I am using the package xfp to generate the random numbers. However, I ...
Angelo Aliano Filho's user avatar
3 votes
3 answers
321 views

Can a PDFLaTeX file contain a random number based on the end user?

Suppose I want to design a math exam to be posted as a single PDF file, for example one asking students to solve $ax^2+bx+c=0$. But I want each student who gets the PDF file to see a different set of $...
Maesumi's user avatar
  • 9,139
4 votes
1 answer
619 views

Random seed each compilation in XeLaTeX

I've found two answers for ``How to get a new PGF seed each compilation?'' 1 2, and they work wonderfully on PdfLaTeX. However, neither of the methods work on XeLaTeX. I get the error ! Undefined ...
Imp54's user avatar
  • 83
0 votes
2 answers
158 views

Plot a random parabola via standard form and rewrite in expanded form

I have another question in regards to using expl3. I am trying to generate a random parabola and then print a rewritten form of that generated equation. I have a \NewDocumentCommand named \parabola. I ...
David G.'s user avatar
  • 329
4 votes
1 answer
266 views

Sorting a list of randomly generated numbers

This is a part two of a question I asked a few days ago and was answered rather spectacularly by user egreg, which you can find here. I'm now looking to take part of the LaTeX provided to me, and ...
David G.'s user avatar
  • 329
1 vote
4 answers
448 views

Using an alias / variable as an input for a newcommand

I am currently trying to set up a conditional statement that takes a randomly assigned integer, and provides a specific output depending on if the integer is odd or even. I've written this so far \...
David G.'s user avatar
  • 329
1 vote
1 answer
60 views

Randomly order document content at view-time

In economics, author order is traditionally alphabetical. Due to the known bias induced by this ordering, there is small movement to randomly order a paper's authors (example). I can order document ...
kyle's user avatar
  • 449
3 votes
2 answers
440 views

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, last=1]{lcg} \newcommand{\random}{\rand\...
Timo's user avatar
  • 31
1 vote
2 answers
120 views

Obtain a table of non-uniformly-distributed random 0 and 1 draws

I wish to produce a n x m matrix of randomly-drawn 0s and 1s, in which draws are fresh with each compilation. So far, I have achieved this with the following code for a 15 x 10 table. However, 0s and ...
monkey-dart's user avatar
2 votes
1 answer
167 views

Setting variables to random numbers for pgfplots

In the declare function scope, I am trying to set randomized numbers to variables, as shown in the code: \documentclass[12pt]{article} \usepackage{pgfplots} \usepackage{float} \pgfplotsset{compat=1.17}...
Superman's user avatar
  • 1,625
0 votes
1 answer
1k views

Fresh Numbering for theorems and Lemma in new chapter [duplicate]

I am building a report document. I want to start the numbering of lemmas and theorem with 1 in every new chapter. For example, I have 3 Lemmas and 2 theorems in Chapter number 1. Now, in chapter 2 I ...
Kumar's user avatar
  • 107
1 vote
1 answer
231 views

Saving Random Numbers in xsim for Solutions

I'm trying to create exercise sheets with random numbers and xsim. Each time I generate random numbers, though, the variables are overwritten to create new exercises (desired), but also overwritten so ...
WeCanLearnAnything's user avatar
3 votes
1 answer
108 views

TikZ: "escaping" random path

On page 1024 of the PGF manual there is a small code to draw random paths which are "contained", or which don't escape too far from their starting points. I copied part of the code to draw that sort ...
mathbekunkus's user avatar
  • 1,389
0 votes
1 answer
95 views

How do random numbers in expl3 Syntax work?

This is a follow-up to a prior question of mine. The same device is used in a number of other randomness-related questions here though. What exactly is the source of (pseudo)randomness when writing ...
shuhalo's user avatar
  • 2,575
3 votes
2 answers
439 views

Tikz: Randomly drop connections in neural network

I used Tikz to draw a full connected neural network. Now I would like to drop randomly a certain proportion of arrows. How can I do that and is it possible to use my code for that? Here is my code and ...
Gilfoyle's user avatar
  • 1,195
1 vote
2 answers
201 views

Random number generator for case distinctions

I would like to compile a snippet of code using a random case distinction. How can I implement that? No-LaTeX pseudocode: x = rand(1,4) // random number between 1 and 4 if( x == 1 ) Let us talk ...
shuhalo's user avatar
  • 2,575
7 votes
2 answers
375 views

Modeling randomly generated inscribed triangles

The problem I am modeling: Three points are randomly chosen on a circle. What is the probability that the triangle formed by these three points contains the center of the circle? Conceptual ...
Logan Weinert's user avatar
7 votes
2 answers
361 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 ...
lAtExFaN's user avatar
  • 1,141
0 votes
1 answer
128 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) ...
Josest CO's user avatar
3 votes
2 answers
698 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 ...
electriclady's user avatar
2 votes
2 answers
124 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 ...
CasperYC's user avatar
  • 697
2 votes
2 answers
247 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,...
e_moro's user avatar
  • 888
8 votes
4 answers
9k 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 ...
Justapigeon's user avatar
1 vote
2 answers
1k 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 ...
Zuriel's user avatar
  • 876
1 vote
0 answers
84 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 ...
Maesumi's user avatar
  • 9,139
1 vote
0 answers
301 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 ...
user157012's user avatar
1 vote
1 answer
99 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 ...
N3buchadnezzar's user avatar
2 votes
2 answers
270 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 ...
PaulS's user avatar
  • 537
4 votes
1 answer
1k 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 ...
Rhynden's user avatar
  • 225
3 votes
2 answers
633 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 ...
levitopher's user avatar
18 votes
2 answers
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 ...
Thanos's user avatar
  • 12.5k
2 votes
2 answers
607 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 ...
rhlchd's user avatar
  • 21