import { Callout } from "nextra/components"; import REPL from "../../components/REPL";
Immutable: This does not mutate the given array.Shuffles the given array values.
import { shuffle } from '@opentf/std';
shuffle<T>(arr: T[]): T[]
shuffle([]) //=> []
shuffle([1]) //=> [1]
shuffle([1, 2, 3, 4, 5]) //=> [ 2, 4, 5, 1, 3 ]
shuffle('Apple') //=> [ 'p', 'e', 'A', 'l', 'p' ]
<REPL code={`const { shuffle } = require('@opentf/std');
shuffle([1, 2, 3, 4, 5]); `} />