# Chalk Python SDK Reference: Random Functions
source: https://docs.chalk.ai/api-docs#section-random-functions

## `random(n)`
source: https://docs.chalk.ai/api-docs#random

Generate a random number.

If no arguments are provided, a random float between `[0.0, 1.0)` is returned. If `n` is provided, a random integer between `[0, n)` is returned.

**Parameters**

- `n`: `int | None` = `None`
  The upper bound for the random integer. If [`None`](https://docs.python.org/3/library/constants.html#None), a random float is returned.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class RandomExample:
   id: int
   random_float: float = F.random()
   random_int_bounded: int = F.random(10)
```

## `secure_random(min_val, max_val)`
source: https://docs.chalk.ai/api-docs#secure_random

Generate a cryptographically secure random number.

If no arguments are provided, a random float between `[0.0, 1.0)` is returned. If two arguments are provided, a random number between `[min_val, max_val)` is returned.

**Parameters**

- `min_val`: `Any` = `None`
  The minimum bound for the random number. If [`None`](https://docs.python.org/3/library/constants.html#None), returns float in [0.0, 1.0).
- `max_val`: `Any` = `None`
  The maximum bound for the random number. Required if min_val is provided.

**Examples**

```python
import chalk.functions as F
from chalk.features import _, features
@features
class SecurityToken:
   id: str
   token_seed: float = F.secure_random()
   random_score: int = F.secure_random(1, 100)
```
