-
Notifications
You must be signed in to change notification settings - Fork 5
randomInfix
Subhajit Sahu edited this page Nov 20, 2022
·
2 revisions
Pick an arbitrary infix.
Similar: randomInfix, infixes, hasInfix, searchInfix.
function randomInfix(x, n, fr)
// x: an array
// n: number of values [-1 ⇒ any]
// fr: random number generator ([0, 1))
const array = require('extra-array');
var x = [1, 2, 3];
array.randomInfix(x);
// → [ 1, 2 ]
array.randomInfix(x, 1);
// → [ 2 ]
array.randomInfix(x, 1);
// → [ 3 ]