intern-Assignment/Node-Assignments/practice-2/node_modules/unique-random-array/index.d.ts
2025-01-31 15:20:39 +05:30

17 lines
428 B
TypeScript

/**
Get consecutively unique elements from an array.
@returns A function, that when called, will return a random element that is never the same as the previous.
@example
```
import uniqueRandomArray from 'unique-random-array';
const random = uniqueRandomArray([1, 2, 3, 4]);
console.log(random(), random(), random(), random());
//=> 4 2 1 4
```
*/
export default function uniqueRandomArray<T>(array: readonly T[]): () => T;