Probabilities

## Introduction

While Perchance is a random generator, you can adjust the likelihood, odds, or probability of a certain item to be more common or rare to be selected in generation. Probabilities are important for text generators like "Random Item Generator" since there are certain items that are rarer to be generated or selected and there are items that are common to be generated or selected. This page will talk about simple probabilities. For more complex or *dynamic* probabilities, check out Dynamic Odds.

## Example

Let's imagine we're building a "random meal generator". Here's a basic version of how it might look:

```
description
	It's a [adjective] dish with [type] [main].
	The [adjective] [main] is paired with a [size] serving of [condiment]-covered [side].
	A [main] with a bit of [condiment] and some [adjective] [side] on the side.

adjective
	vegan
	Indonesian
	Italian
	delicious

main
	risotto
	pie
	stir-fry
	curry

side
	bowl of rice
	salad
	fries
	fried mushrooms
	pumpkin soup

type
	a [size] serving of
	well-cooked
	unusually fresh
	roasted

size
	small
	large
	tiny

condiment
	pepper
	salt
	chilli flakes
	oregano

```

This generator would probably produce nonsense, but that's okay - it's just to demonstrate some concepts. Now, how do we make some items more common than others? For example, what if we wanted "pepper" to be twice as likely as the other condiments? Here's how you'd do that:

```
condiment
	pepper ^2
	salt
	chilli flakes
	oregano

```

This "up arrow" character (above number 6 on your keyboard) allows you to change the likelihood that an item will be selected. `^2` makes it twice as likely, `^100` makes it 100 times more likely compared to the others. All items have a default odds of `1` - you can imagine that each item has `^1` after it by default. You can also make an item less likely:

```
condiment
	pepper ^2
	salt
	chilli flakes ^0.1
   oregano

```

This makes "chilli flakes" quite unlikely, especially compared to pepper. In this example pepper is 20 times more likely than chilli flakes. And salt is 10 times more likely than chilli flakes. Makes sense? The number after the `^` is the item's "odds" or "weight" during the random selection process. You can use fractions like `^1/10` instead of `^0.1` if that's easier for you.

## Probability Styling

As an example for Dice Roll Tables, like:

 2-5
 6

The `Not Helpful` has odds of 1 out of 6 as well as the `Helpful`, while `Normal` has 4 out of 6. We can stylize it in Perchance with probabilities:

### Fraction Style

Fraction Style uses fractions to indicate the probabilities. This makes the probabilities less than one.

```
Item
   Not Helpful ^1/6
   Normal ^4/6
   Helpful ^1/6

```

### Decimal Style

Decimal Style is like the Fraction Style but uses numbers with decimal points to indicate the probabilities. This makes the probabilities less than one.

```
Item // Decimal
   Not Helpful ^0.1666666666
   Normal ^0.6666666666
   Helpful ^0.16666666666

```

### Integer Style

Integer Style uses integers to indicate the probabilities. This makes the probabilities more than or equal to one.

```
Item
   Not Helpful
   Normal ^4
   Helpful

```

### Literal Style

Literal Style does not use the `^` method of Perchance and "Literally" lists the possibilities in the list. This makes each probability equal to one but the number of same items in the list adds to the probability.

```
Item // Literal
   Not Helpful
   Normal
   Normal
   Normal
   Normal
   Helpful

```

You can mix the **Decimal** and **Fractional** since they are both using **less than 1** probabilities. **Literal** and **Integer** can also be mixed since both are using **more than 1** probabilities.

Here is an example showing the equivalences of the probability of each styling.

## Shorthand Probabilities

If you wanted each alphanumeric character to have an equal likelihood of being selected, then you would need to **weight each sub-block according to the number of items** it has: `{{a-z}^26|{A-Z}^26|{0-9}^10}`.

If that doesn't make sense to you, don't worry - just remember that you can change the odds of each part of the curly block to suit your needs.