# Random

## Functions

random(min,max)→number

`min`

`number`

optional

The minimum possible number

`max`

`number`

optional

The maximum possible number

Returns a random number between `min` and `max`.

The range of possible values is inclusive, so it's possible to get `min` or `max` back! Random numbers are distributed uniformally, meaning it's just as likely you'll get any number in the range.

There are several ways to call `random()` that have different effects:

```
random();
// A random number between 0 and 1
// e.g. 0.2999…

random(5);
// A random number between 0 and 5
// e.g. 1.4993…

random(3, 5);
// A random number between 3 and 5
// e.g. 3.5997…
```

randomInt(min,max)→number

`min`

`number`

optional

The minimum possible integer

`max`

`number`

optional

The maximum possible integer

Returns a random integer between `min` and `max`.

This function is similar to `random()`, and can be called in the same way. The only difference is that it will only return integer values.

```
randomInt(10);
// A random integer between 0 and 10 (inclusive)
// e.g. 4

randomInt(3, 5);
// A random integer between 3 and 5 (inclusive)
// e.g. 4
```

randomDirection(length)→[Vec](https://cuttle.xyz/learn/reference/Vec)

`length`

`number`

optional

The length of the random vector. If unspecified, the vector will be of unit length.

Returns a random vector of `length`.

```
randomDirection();
// A random vector of unit length
// e.g. Vec(-0.3082…, 0.9513…)

randomDirection(10);
// A random vector of length 10
// e.g. Vec(-3.0822…, 9.5132…)
```

randomPointInDisk(radius)→[Vec](https://cuttle.xyz/learn/reference/Vec)

`radius`

`number`

optional

The maximum possible length of the random vector. If unspecified, the maximum length will be 1.

Returns a random vector contained within a circle of `radius`.

```
randomPointInDisk();
// A random vector contained within a circle of radius 1
// e.g. Vec(-0.5466…, 0.0334…)

randomPointInDisk(10);
// A random vector contained within a circle of radius 10
// e.g. Vec(-5.4658…, 0.3345…)
```