pseudo-shuffle
Version:
Make the index look like it is shuffled according to the range so that it is not conflicted without the actual shuffle.
34 lines (33 loc) • 1.02 kB
TypeScript
export interface IPsuedoShuffleOption {
/**
* The starting value of the shuffleable range.
*/
min: number;
/**
* The ending value of the shuffleable range.
*
* Algorithm can be applied only when the difference
* between the min and max values is at least 4.
*/
max: number;
/**
* The index value to be shuffled.
*/
index: number;
/**
* The private key used to encrypt the index value.
*
* If not specified, the default value is used.
* (**Default value:** `psuedo-shuffle`)
*/
privateKey?: string;
/**
* The public key used to encrypt the index value.
*
* If not specified, the default value is used.
* (**Default value:** `psuedo-shuffle`)
*/
publicKey?: string;
}
export declare const encode: ({ index, min, max, privateKey, publicKey, }: IPsuedoShuffleOption) => number;
export declare const decode: ({ index, min, max, privateKey, publicKey, }: IPsuedoShuffleOption) => number;