# Shuffle reproducibly from a seed

> Pass a seeded random source to shuffled, and the same seed gives the same order on every machine.

**Few items**

```ts
import { splitmix32 } from 'knotkit/prng'
import { shuffled } from 'knotkit/sampling'

const players = ['ada', 'grace', 'alan', 'edsger', 'barbara']

const first = shuffled(splitmix32(2026), players)
const again = shuffled(splitmix32(2026), players)

first // ['ada', 'grace', 'edsger', 'barbara', 'alan']
first.join() === again.join() // true
players // ['ada', 'grace', 'alan', 'edsger', 'barbara'], the input is untouched
```

**Thousands of items**

```ts
import { splitmix32 } from 'knotkit/prng'
import { shuffled } from 'knotkit/sampling'

// 10,000 players, each with an id.
const players = Array.from({ length: 10_000 }, (_, index) => `player-${index}`)

const first = shuffled(splitmix32(2026), players)
const again = shuffled(splitmix32(2026), players)

first.length // 10000
first.join() === again.join() // true, the seed replays the same order
players[0] // 'player-0', the input is untouched
```

Nothing in Knotkit seeds itself. Record the seed with the result, and anyone can replay it.

**Modules:** [`knotkit/sampling`](/modules/sampling/) · [`knotkit/prng`](/modules/prng/) · [API reference](/reference/knotkit/sampling/)
