UNPKG

crypto-secure-shuffle

Version:

Cryptographically secure shuffle using the Durstenfeld algorithm with a CSPRNG.

15 lines (14 loc) 518 B
import "source-map-support/register"; /** * Shuffles the provided array using the Durstenfeld algorithm with a * cryptographically secure pseudo random number generator. * This produces an unbiased random permutation of the original array. * * Note: This method mutates the original array. * @param array The array to shuffle. * @returns A promise which resolves to the shuffled array. */ declare function secureShuffle<T>(array: T[]): Promise<T[]>; export = secureShuffle; declare namespace secureShuffle { }