Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 669 Bytes

shuffle.mdx

File metadata and controls

39 lines (24 loc) · 669 Bytes

import { Callout } from "nextra/components"; import REPL from "../../components/REPL";

Shuffles the given array values.

Immutable: This does not mutate the given array.

Syntax

import { shuffle } from '@opentf/std';

shuffle<T>(arr: T[]): T[]

Examples

shuffle([]) //=> []

shuffle([1]) //=> [1]

shuffle([1, 2, 3, 4, 5]) //=> [ 2, 4, 5, 1, 3 ]

shuffle('Apple') //=> [ 'p', 'e', 'A', 'l', 'p' ]

Try

<REPL code={`const { shuffle } = require('@opentf/std');

shuffle([1, 2, 3, 4, 5]); `} />

Learn