The tag has no usage guidance.

learn more… | top users | synonyms

12
votes
3answers
343 views

How to Generate Random Negative Integer?

I am trying to create a worksheet constituted of random numbers so that kids can practice integer operations. E.g. 3+-9=? 2x(-5)=? 18/-3=? Etc. How do I do this? Here is what I've tried so far. ...
4
votes
1answer
96 views

Randomize answers in examdesign documentclass?

I am using the examdesign documentclass to write multiple versions of a multiple choice test. The package is great at randomizing question ordering, but I would like to randomize answer order as well. ...
1
vote
0answers
22 views

Fill column with random numbers using datatool and PGF

Consider the following csv file: column1,column2 line1, line2, I want to fill column2 with random numbers, preferably using PGF (simply because I already know a bit about PGF, but I am open to ...
15
votes
3answers
1k views

How to have a real random pattern?

How to have a new recalculated random pattern? This one is the same translated everywhere. Edit I perfectly understand that the pattern is calculated once and drawn several times after. My question ...
3
votes
1answer
153 views

A simple if-then statement in tikz

I have been trying to generate a graph where two vertices are connected with probability p. Here is what I tried so far, \pgfmathsetseed{\number\pdfrandomseed} \begin{tikzpicture} % size of circle \...
11
votes
3answers
767 views

\rand inside \forloop creates identical values

I try to create a table with random entries... By browsing the random tag, I found some help on random number generators and I tried using lcg. Surprisingly I seem to create the same random number ...
2
votes
1answer
57 views

Shuffling table rows using PGF

Does anyone know how to get table with rows randomly shuffled (using \pgfplotstabletypeset from .dat-type file)? My current code is \documentclass{article} \usepackage{filecontents,pgfplotstable} \...
11
votes
1answer
1k views

Conditional using non-integer numbers

I am trying to generate fractals using affine transformations. I need to generate a random number in the interval (0,1), and depending on the value of this random number choose a function to ...
1
vote
1answer
67 views

Is it possible to call/reference sagetex within a latex command?

I'm doing a few projects in which it would be very helpful to get some numbers from a sagetex environment, and then directly using them within latex. I know Latex isn't great at storing numbers/...
42
votes
3answers
1k views

December challenge: Create an Advent Calendar

While thinking about creating an own Advent Calendar for the beloved people around me – instead of buying a boring one with chocolate in it – a thought came to my mind: "How would I draw this in TikZ?"...
0
votes
0answers
33 views

Include Array Elements in a Barcode

I want to use TeX for setting up many barcodes with random numbers. Therefore I generated some random numbers and stored them in a .txt file. To create the barcode, I used a macro from Is there a good ...
3
votes
1answer
175 views

Drawing abstract region with partitions using tikz

I want to draw an abstract region with five partitions, where each partition is shaded and labeled differently. An example region (without the shading) would be as follows:
1
vote
1answer
70 views

Permuting an index list; and creating an index list of 0's and 1's

I want to run the steps of a loop in random order and also save the order in which the iterations were carried out: \documentclass[english]{article} \usepackage{tikz} \newcommand\...
9
votes
2answers
1k views

Automatically generated BINGO cards

I am trying to automatically generate a series of BINGO cards. So, I need a 5 x 5 table with square cells that allow text wrapping. I also want to randomly assign a word to each cell from a "bank" ...
0
votes
1answer
121 views

How can I randomly perturb the position of a grid of nodes?

I have a grid of nodes generated by the following code: \documentclass[tikz]{standalone} \usepackage{pgfplots} \tikzset{ small-node/.style={ shape=circle, fill=white, draw,...
4
votes
0answers
75 views

guess a number proportional to another [closed]

This is a challenging question. I am not sure how to begin coding it, or whether it is easily possible in TeX. I wish to define a command that takes in input of a simple formula such as Z = X x N + N^...
1
vote
0answers
79 views

Generating practice sheets for characters

I'm currently learning japanese, and since they have different characters, I'm doing some practice where I make a table, in which each cell contains the pronounciation of one of their characters, and ...
2
votes
1answer
102 views

How do I empty a list pgfmath randomlist

I'm trying to use \pgfmathrandomlists. I know that the command \pgfmathdeclarerandomlist{list}{{item1}{item2}...} produces a list and that the command \pgfmathrandomitem select a random item from a ...
3
votes
1answer
101 views

! Argument of \pgfmathrnd@@ has an extra }

The followin code gives this error : ! Argument of \pgfmathrnd@@ has an extra }. <inserted text> \par l.12 } ? ! Emergency stop. <inserted text> \...
4
votes
2answers
446 views

Is it a convenient way to write longer program codes in LaTeX?

Before I only used ifthenelse and for loops, but not complicated data structures. I don't know what is the convenient way to write longer codes. As an example I would like to generate a random ...
6
votes
1answer
609 views

Why do I need to wait about 30 seconds or more to generate a new set of questions in this code?

This is a follow-up question to this question: Generate exam from a question bank? In the following code by @Werner, I am curious to know why do I need to wait about 30 seconds or more to ...
9
votes
1answer
377 views

fill the interior of a randomly constructed closed path

I am not sure how to proceed in filling the interior of a randomly generated (via a random decoration) path. I began with code given in the answer to this question and worked on it since the basic ...
4
votes
1answer
269 views

Randomize a section of code lines

This is similar to a previous question, but I didn't really understand the answer given. One possible use of what I'm asking is in the following code for a Matching style of question, where lines of ...
2
votes
0answers
89 views

Problem with Dense distribution

What is poisson.sty? and how can i fix this problem because I want to run the below code but there is an error ( poisson.sty not found) \documentclass{article} \usepackage{tikz} \usepackage{poisson} \...
17
votes
2answers
713 views

Randomly assign background colour for each frame

How can a randomly picked background colour be chosen for each beamer frame? Note: This question is asked to round out the question Randomly assign color to background in the PDF whenever page is ...
7
votes
4answers
1k views

Drawing randomly ragged lines in technical drawings

I am having issues getting started on drawing a randomly ragged line, with finite variation, between two endpoints. The random function which uses variable rnd I think can be used, for instance, ...
3
votes
1answer
343 views

Random selection of file issues

I have tried to create an exam with random questions selected from different files as shown here. The code I used works but is only randomized on a random basis; i.e. for 1st round it gives a set of ...
6
votes
1answer
979 views

How do I generate in LaTeX a list of random questions avoiding repetitions?

How do I generate in LaTeX a list of random questions avoiding repetitions? \documentclass{article} \usepackage[pdftex]{exerquiz} \usepackage{enumitem} \usepackage{tikz} \newcommand*{\ListOfTopics}{%...
36
votes
4answers
4k views

tikz: Distribute evenly and randomly circles

I want to fill a part of a picture with more or less evenly and randomly distributed circles which should not overlap. It would be okay if circles are only partly inside the shape. The density should ...
25
votes
2answers
645 views

Can LaTeX select a random line from another file?

Can LaTeX select a line from one file and include it in the main file? I use the exam class to make course exams. I like to include a brief quote related to the course in the footer of the last exam ...
7
votes
0answers
234 views

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 clunky!) \...
10
votes
5answers
3k views

Randomised LaTeX based multiple choice test

I would like to create a multiple choice test with LaTeX. It has the following boundary conditions: 20 questions (q) per test . 20 students (s) take the test, the order of the question should be ...
6
votes
1answer
336 views

MetaPost: Randomly variably thick curves

Overview Looking to emulate the following sinusoidal wave having random variations in both its filled and outline thickness: The wave has two parts: a variably thick filling and a variably thick ...
7
votes
1answer
249 views

MetaPost: Randomly generated number, distinct from previously generated number

Overview Looking to create random page background colours where the same background colour never appears more than once in succession (i.e., red, green, blue, green, blue, red, etc. -- never red, red,...
7
votes
1answer
229 views

ConTeXt+MetaPost: Non-conflicting random background and foreground colours

Overview Looking to create a page that has a random (and non-consecutively repeating) background colour with titles that are also random. Problem The code has two problems. First, generating a ...
7
votes
2answers
738 views

Arbitrary Ragged Curves for Phase Diagram in TikZ

How can one draw a good looking curved random line extending along a diagonal connecting two arbitrary nodes in TikZ? (Also, how do I add arrowheads like I would usually do, or do I have to create ...
12
votes
2answers
1k views

How to Generate Random Variables then Use in Calculations in pdflatex

I'm basically trying to create multiple versions of a worksheet, each with different values for the variables in each question. To do this I'm defining random variables, then each time I compile the ...
8
votes
1answer
424 views

How to correctly decorate an ellipse with random steps

To create something that looks like the shape of a lake, the following code transforms the border of a blue ellipse with smooth random steps. The idea is taken from another answer. \documentclass[...
10
votes
1answer
604 views

Gaussian random numbers

The Tikz manual has all sorts of different options regarding math, but the following is the first version which actually worked. Is there a better way to do this? \documentclass{article} \usepackage{...
23
votes
3answers
720 views

How do I put a die roll at the top of each page?

I was thinking about a trick I heard of in old RPG books and wondered how you would do it in LaTeX. So it used to be hard to find RPG dice in stores (That is, dice with 4, 6, 8, 10, 12 and 20 sides. ...
6
votes
1answer
91 views

Why doesn't fancyhdr like random numbers?

In the following MWE I use \lhead{\stepcounter{step}\arabic{step}} and it works perfectly, incrementing by 1 each page. I also use \chead{\setrand{100}\arabic{rand}} and get the same number every ...
11
votes
3answers
1k views

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 ...
11
votes
1answer
407 views

Random number without repetition in an \includegraphics

I have 58 images in PDF format. At the moment, each of them is in a separate PDF, such as 1.pdf, 2.pdf etc. I would like to include those 58 images in a random order without repetition. I found the '...
6
votes
1answer
623 views

Have a new seed in pgfmath more often

I'm using pgfmath in my code since I need some randomness and I want the seed used for the randomness to be updated each time I compile. I read that pgfmath is updating the seed every minute, which is ...
5
votes
1answer
136 views

Print arguments of a macro in a random order

I have the following (simplified) LaTeX code that simply prints all its arguments. \newcommand{\mm}[4]{#1 #2 #3 #4} Now, I would like the arguments to be printed in a random order, e.g., #2 #1 #4 #...
7
votes
2answers
250 views

Generating random conversions

I am working on a system to randomly generate some exercises on unit conversion. The students get a exercise like 27.89 mm = ...... hm I achieved this whit the use of a random value generator ...
10
votes
1answer
2k views

Randomized coordinates in TikZ

I need to draw a number of `bacteria' in TikZ. Their coordinates and orientation needs to be random within a pre-defined scope. I have randomized the orientation successfully, but not the location of ...
6
votes
1answer
392 views

Creating random patterns in TikZ

I'm interested in doing two (not completely) separate things in TikZ, if I should open another question for one part, please tell me so. What I'm interested in is: Create a random array of filled ...
3
votes
2answers
393 views

How can I make random placed edges between two graph partitions?

I have to nodes (V1) and (V2) (representing sets of graph vertices) and I want to draw, say, 10 edges(lines) between them. I don't want to hardcode random locations so I did: \begin{pgfonlayer}{bg} % ...
7
votes
1answer
667 views

Draw randomized tree in TikZ

I am trying to draw a randomized tree using TikZ, that is, I'm looking for a macro \randtree{NN}{x} that attaches a randomized tree of maximum depth x to a node named NN. The nodes need not be visible ...