# shuffled

> **shuffled**<`T`>(`random`, `values`): readonly `T`\[]

Defined in: [packages/sampling/src/shuffle.ts:12](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/sampling/src/shuffle.ts#L12)

Return a uniformly shuffled copy of `values` using Fisher-Yates.

Runs in O(values.length) time and uses O(values.length) space for the copy. The input is never mutated.

## Type Parameters

### T

`T`

## Parameters

### random

[`RandomSource`](/reference/knotkit/prng/type-aliases/randomsource/)

### values

readonly `T`\[]

## Returns

readonly `T`\[]

## Throws

With code `INVALID_SOURCE_VALUE` when the random source returns a value outside `[0, 1)`.
