ts-math
Version:
A collection of math functions and packages written in Typescript
18 lines (17 loc) • 603 B
TypeScript
/**
* The factorial of n.
*/
export declare function fact(n: number): number;
/**
* Rotate the elements in array from index n to m. Example [0,1,2,3,4,5], 2,4 => [0,1,4,2,3,5]
* @param {Array} arr - The array to rotate
* @param {int} n - Start index
* @param {int} m - End Index (including)
*/
export declare function rotate(arr: number[], n: number, m: number): void;
/**
* Permutes an array.
* @param {*} arr - The array to permute
* @param {*} idx - The permutation index. An index between 0 and fact(arr.length)-1
*/
export declare function permute(arr: number[], idx: number): number[];