@extra-array/permutation

Picks an arbitrary permutation.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-array/permutation
1402.10.197 months ago3 years agoMinified + gzip package size for @extra-array/permutation in KB

Readme

Picks an arbitrary permutation. :package: :smileycat: :running: :vhs: :moon: :scroll: :newspaper: :bluebook:
Alternatives: permutation, permutation$.
Similar: permutation, permutations, hasPermutation.

This is part of package extra-array.



array.permutation(x, [n], [r]);
// x: an array
// n: number of values (-1 => any)
// r: random seed 0->1

const array = require("extra-array");

var x = [1, 2, 3, 4, 5];
array.permutation(x, 5);
// [ 2, 4, 5, 1, 3 ]

array.permutation(x, 5, 0.3);
// [ 5, 3, 1, 2, 4 ]

array.permutation(x, 3, 0.3);
// [ 5, 3, 1 ]



References