Picks an arbitrary permutation.
npm install @extra-array/permutation-update.minPicks an arbitrary permutation.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Alternatives: [permutation], [permutation$].
> Similar: [permutation], [permutations], [hasPermutation].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
> This is browserified, minified version of [@extra-array/permutation-update].
> It is exported as global variable array_permutation$.
> CDN: [unpkg], [jsDelivr].
[@extra-array/permutation-update]: https://www.npmjs.com/package/@extra-array/permutation-update
[unpkg]: https://unpkg.com/@extra-array/permutation-update.min
[jsDelivr]: https://cdn.jsdelivr.net/npm/@extra-array/permutation-update.min
``javascript`
array.permutation$(x, [n], [r]);
// x: an array (updated)
// n: number of values (-1 => any)
// r: random seed 0->1
// → x
`javascript
const array = require("extra-array");
var x = [1, 2, 3, 4, 5];
array.permutation$(x, 5);
// [ 2, 4, 5, 1, 3 ]
x;
// [ 2, 4, 5, 1, 3 ]
var x = [1, 2, 3, 4, 5];
array.permutation$(x, 5, 0.3);
// [ 5, 3, 1, 2, 4 ]
var x = [1, 2, 3, 4, 5];
array.permutation$(x, 3, 0.3);
// [ 5, 3, 1 ]
``
- shuffle: PHP
- Array.shuffle: sugarjs
- shuffle-seed: @webcaetano
- shuffle-array: @pazguille
- Seeding the random number generator in Javascript
[permutation]: https://github.com/nodef/extra-array/wiki/permutation
[permutation$]: https://github.com/nodef/extra-array/wiki/permutation$
[permutations]: https://github.com/nodef/extra-array/wiki/permutations
[hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation