# random()

## Example

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FdV1bqtOnx0zlVDOYLm6L%2Frandom(min%2C%20max).gif?alt=media&#x26;token=a4418201-ce15-49a8-a0ac-eb24b448f0c7" alt=""><figcaption></figcaption></figure>

```python
    circle(random(0, width), random(0, height), 25)
```

### Syntax

#### Pick a random number between two values

```
random([min], [max])
```

| Input | Description                     |
| ----- | ------------------------------- |
| min   | the minimum number of the range |
| max   | the maximum number of the range |

#### Pick a random value from a list

```
random(choices)
```

| Input   | Description                   |
| ------- | ----------------------------- |
| choices | a list of values to pick from |

<figure><img src="https://768248463-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqbs7pgU3AVBY06Rl9M31%2Fuploads%2FKvO402ARpAoyfWkLciEF%2Frandom%20names%20and%20likes%20on%20pink%20background.gif?alt=media&#x26;token=e615b55b-71ea-4632-a416-b2365d1fe04b" alt=""><figcaption></figcaption></figure>

<details>

<summary>Example Full Code</summary>

```
def draw():
    background(255,79,132)
    names = ["John", "Ali", "Tamir", "Ibrahim"]
    actions = ["plays", "watches", "doesn't like"]
    things = ["football", "basketball", "chess"]

    orange = (255,164,28)
    purple = (112,88,255)
    blue = (44,129,237)

    colors = [orange,purple,blue]

    fill(random(colors))
    text(random(names), 75, 250)
    fill(random(colors))
    text(random(actions), 150, 150)
    fill(random(colors))
    text(random(things), 225, 50)
```

</details>

### Description

This function returns a **random decimal (float/double)** value out of a **continuous** range of numbers, between a minimum and maximum, or returns a random value out of a **discrete** list of any data types.

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}
