---
title: "Math & Task Utilities"
description: "Random numbers, coherent noise and basic timing helpers available to Glorpia Luau."
canonical: "https://docs.glorpia.com/scripting/utilities"
markdown: "https://docs.glorpia.com/scripting/utilities.md"
---
# Math & Task Utilities

Random numbers, coherent noise and basic timing helpers available to Glorpia Luau.

**Category:** Scripting / API

## Infinity

```luau
inf
```

`inf` is the positive-infinity numeric value. Use `-inf` for negative infinity. Scalar number properties can use infinity when their property range permits it. Integer properties convert infinity to the corresponding integer limit.

## math.random()

```luau
math.random()
```

```luau
math.random(max)
```

```luau
math.random(min, max)
```

| Name | Type | Description |
| --- | --- | --- |
| `no arguments` | number | Returns a pseudo-random number from 0 up to but not including 1. |
| `max` | integer | Returns an integer from 1 through max. |
| `min, max` | integer | Returns an integer in the inclusive range. |

```luau
local roll = math.random(1, 6)
print("Rolled", roll)
```

## math.noise()

```luau
math.noise(x, y?, z?)
```

Returns deterministic, smoothly interpolated coherent noise in approximately the -1 to 1 range. Missing Y or Z coordinates default to 0.

```luau
for x = 0, 5 do
    local value = math.noise(x * 0.15, 0, 0)
    print(x, value)
end
```

## task.wait()

```luau
task.wait(seconds?)
```

| Name | Type | Description |
| --- | --- | --- |
| `seconds` | number? | Requested delay. Defaults to about one frame. |
| `return` | number | Actual elapsed wait time in seconds. |

```luau
print("before")
task.wait(0.5)
print("after")
```
