@extra-array/subsequence
v2.10.19
Published
Picks an arbitrary subsequence.
Downloads
313
Readme
Picks an arbitrary subsequence. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Similar: subsequence, subsequences, hasSubsequence, searchSubsequence.
This is part of package extra-array.
array.subsequence(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.subsequence(x);
// [ 1, 2 ]
array.subsequence(x, 3, 0.3);
// [ 1, 3, 5 ]
array.subsequence(x, 2, 0.3);
// [ 3, 5 ]