1+ //
2+ // THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND!
3+ //
14/**
25 * combinatorics.js
36 *
1215 * @link : http://en.wikipedia.org/wiki/Factorial_number_system
1316 * @link : https://en.wikipedia.org/wiki/Combinatorial_number_system
1417 */
15- export const version = '2.1.2' ;
18+ const version = '2.1.2' ;
1619/**
1720 * calculates `P(n, k)`.
1821 *
1922 * @link https://en.wikipedia.org/wiki/Permutation
2023 */
21- export function permutation ( n , k ) {
24+ function permutation ( n , k ) {
2225 if ( n < 0 )
2326 throw new RangeError ( `${ n } is out of range` ) ;
2427 if ( k < 0 )
@@ -37,7 +40,7 @@ export function permutation(n, k) {
3740 *
3841 * @link https://en.wikipedia.org/wiki/Combination
3942 */
40- export function combination ( n , k ) {
43+ function combination ( n , k ) {
4144 if ( 0 == k )
4245 return 1n ;
4346 if ( n == k )
@@ -51,7 +54,7 @@ export function combination(n, k) {
5154 *
5255 * @link https://en.wikipedia.org/wiki/Factorial
5356 */
54- export function factorial ( n ) {
57+ function factorial ( n ) {
5558 return permutation ( n , n ) ;
5659}
5760/**
@@ -60,7 +63,7 @@ export function factorial(n) {
6063 * @link https://en.wikipedia.org/wiki/Factorial_number_system
6164 * @param {number } l the number of digits
6265 */
63- export function factoradic ( n , l = 0 ) {
66+ function factoradic ( n , l = 0 ) {
6467 if ( n < 0 )
6568 throw new RangeError ( `${ n } is out of range` ) ;
6669 let [ bn , bf ] = [ BigInt ( n ) , 1n ] ;
@@ -87,7 +90,7 @@ export function factoradic(n, l = 0) {
8790 *
8891 * @link https://en.wikipedia.org/wiki/Combinatorial_number_system
8992 */
90- export function combinadic ( n , k ) {
93+ function combinadic ( n , k ) {
9194 const count = combination ( n , k ) ;
9295 const [ bn , bk ] = [ BigInt ( n ) , BigInt ( k ) ] ;
9396 return ( m ) => {
@@ -124,7 +127,7 @@ const _randomBytes = typeof _crypto['randomBytes'] === 'function'
124127 * @param {anyint } min
125128 * @param {anyint } max
126129 */
127- export function randomInteger ( min = 0 , max = Math . pow ( 2 , 53 ) ) {
130+ function randomInteger ( min = 0 , max = Math . pow ( 2 , 53 ) ) {
128131 let ctor = min . constructor ;
129132 if ( arguments . length === 0 ) {
130133 return Math . floor ( Math . random ( ) * ctor ( max ) ) ;
@@ -142,7 +145,6 @@ export function randomInteger(min = 0, max = Math.pow(2, 53)) {
142145 const rnd = u8s . reduce ( ( a , v ) => ( ( a << ctor ( 8 ) ) + ctor ( v ) ) , ctor ( 0 ) ) ;
143146 return ( ( ctor ( rnd ) * mag ) >> ctor ( len * 8 ) ) + ctor ( min ) ;
144147}
145- ;
146148/**
147149 * Base Class of `js-combinatorics`
148150 */
@@ -218,18 +220,6 @@ class _CBase {
218220 * an alias of `at`
219221 */
220222 nth ( n ) { return this . at ( n ) ; }
221- /**
222- * the seed iterable
223- */
224- seed ;
225- /**
226- * the size (# of elements) of each element.
227- */
228- size ;
229- /**
230- * the number of elements
231- */
232- length ;
233223 /**
234224 * pick random element
235225 */
@@ -249,7 +239,7 @@ class _CBase {
249239/**
250240 * Permutation
251241 */
252- export class Permutation extends _CBase {
242+ class Permutation extends _CBase {
253243 constructor ( seed , size = 0 ) {
254244 super ( ) ;
255245 this . seed = [ ...seed ] ;
@@ -275,8 +265,7 @@ export class Permutation extends _CBase {
275265/**
276266 * Combination
277267 */
278- export class Combination extends _CBase {
279- comb ;
268+ class Combination extends _CBase {
280269 constructor ( seed , size = 0 ) {
281270 super ( ) ;
282271 this . seed = [ ...seed ] ;
@@ -329,8 +318,7 @@ export class Combination extends _CBase {
329318/**
330319 * Base N
331320 */
332- export class BaseN extends _CBase {
333- base ;
321+ class BaseN extends _CBase {
334322 constructor ( seed , size = 1 ) {
335323 if ( size < 1 )
336324 throw new RangeError ( `${ size } is out of range` ) ;
@@ -361,7 +349,7 @@ export class BaseN extends _CBase {
361349/**
362350 * Power Set
363351 */
364- export class PowerSet extends _CBase {
352+ class PowerSet extends _CBase {
365353 constructor ( seed ) {
366354 super ( ) ;
367355 this . seed = [ ...seed ] ;
@@ -384,7 +372,7 @@ export class PowerSet extends _CBase {
384372/**
385373 * Cartesian Product
386374 */
387- export class CartesianProduct extends _CBase {
375+ class CartesianProduct extends _CBase {
388376 constructor ( ...args ) {
389377 super ( ) ;
390378 this . seed = args . map ( v => [ ...v ] ) ;
@@ -410,3 +398,5 @@ export class CartesianProduct extends _CBase {
410398 return result ;
411399 }
412400}
401+
402+ export { BaseN , CartesianProduct , Combination , Permutation , PowerSet , combinadic , combination , factoradic , factorial , permutation , randomInteger , version } ;
0 commit comments