# Random tables

A random table is a page of results that you roll on in View, or draw from with /random while you write.

## The file

A random table is a page with `type: random-table` and a list of results. To make one, open **New…** on a folder, type `random` and choose **Random Table**. A table can go in any folder, so a campaign's rumors can sit in the campaign.

```markdown
---
type: random-table
singular: Rumor
---
# Rumors

- The miller's daughter walks into the bog every new moon
- Someone paid the toll at the rope bridge in old silver
- The tithe barn was built on a barrow
```

- `type: random-table`: Makes this page a random table.
- `singular: Rumor`: What one result is called in the /random list. Without it, the list uses the heading.
- `# Rumors`: The table's name.
- `- The miller's daughter walks into the bog every new moon`: One result per line. Each line has the same chance.

A numbered list works the same way. Dunjii reads up to 200 lines and skips a line longer than 500 characters or one that starts with markdown punctuation such as `**`, `#` or `>`. A table with no lines is left out of `/random`.

## Dice tables

A table whose first column is a die works like a table printed in a book: each row has the chance of the faces it covers.

```markdown
---
type: random-table
---
# Mistwood Encounters

| d8 | Encounter |
| --- | --- |
| 1-2 | 1d4 mire hounds circling the camp |
| 3 | A charcoal burner who has lost his way |
| 4 | Fresh tracks of something large and barefoot |
| 5-6 | Fog thick enough to hide the path for 2d10 minutes |
| 7 | A bog wight standing still in the reeds |
| 8 | Warden Hollis and two scouts on patrol |
```

- `| 1-2 | 1d4 mire hounds circling the camp |`: Covers two faces, so it comes up twice as often as row 3.

The first column is a die when its header is a die, such as `d20` or `2d6`, or when every row in it is a number or a range. With `2d6` in the header the rows follow the odds of the total, so 7 comes up six times as often as 2. On a d100, `00` is 100. A row the dice cannot roll is skipped, and when a row has more than one result column, the columns are read as one result.

## Rolling on the page

Open the table in View. A bar at the bottom of the window shows a die, a box for the number and the result.

- Click the die in the bar to roll. Dunjii marks the row the roll picks and shows its text in the bar, with any dice in it rolled: `1d4 = 3 mire hounds circling the camp`.
- To use your own dice, type the number you rolled. Dunjii marks the row for that number.
- On a page with more than one dice table, click the die in a table's header to roll that table.

![A d8 table after typing 2: the row for 1-2 is marked.](https://dunjii.com/docs-assets/writing/random-table-roll.webp)

The bar rolls the die in the table's header. A list rolls a die with one face per line, so a list of six rumors rolls a d6. Players who open the table from a share link can roll it the same way.

Only a Random Table page rolls by row. A dice table on any other page keeps its dice buttons, and they roll a number without marking a row.

## /random in the editor

In Edit, type `/random` and part of a table's name, then press Enter. Dunjii writes one result where you typed and selects it, so you can see which words came from the table. Press Enter again, or click **Roll again**, to replace it with another result. Press → or ← to keep it and go on typing.

![Typing /random rum offers the Rumor table from the Mistwood campaign.](https://dunjii.com/docs-assets/writing/random-command.webp)

**Random…** in the editor's **+** menu opens the same list in a box. Before you type, the list shows the last five tables you picked in this browser, or **Name** if you have not picked one yet. It holds your own tables and Dunjii's built-in ones: Name, Appearance, Quirk, Secret, and a stock list for each kind of shop. When two of your tables have the same name, the one nearest the page you are writing comes first, so a session's Rumors comes before the campaign's.

`/random` also works in a table cell. There, **Roll again** is a row in the menu under the cell.

On your computer, `dunjii random rumors` draws from the same tables.
