# Sandbox.SandboxSystemExtensions.VectorInCube

## Overload 1

```csharp
static Vector3 VectorInCube(System.Random self, float extents = 1)
```

Uniformly samples a 3D position from a cube with coordinates in the range -`extents` to +`extents`.

### Parameters

- `self` (`System.Random`)
- `extents` (`float`), default `1`

### Returns

`Vector3`

## Overload 2

```csharp
static Vector3 VectorInCube(System.Random self, in BBox box)
```

Uniformly samples a 3D position from a cube

### Parameters

- `self` (`System.Random`)
- `in box` (`BBox`)

### Returns

`Vector3`

Declared in [Sandbox.SandboxSystemExtensions](/api/Sandbox.SandboxSystemExtensions).
Assembly: `Sandbox.System`.
