Skip to content

randomEntry

Subhajit Sahu edited this page Dec 22, 2022 · 1 revision

Pick an arbitrary entry.

Similar: randomEntry, hasEntry.


function randomEntry(x, fr)
// x:  ientries
// fr: random number generator ([0, 1))
const ientries = require('extra-ientries');

var x = [["a", 1], ["b", 2], ["c", 3]];
ientries.randomEntry(x);
// → [ "c", 3 ]

ientries.randomEntry(x);
// → [ "b", 2 ]


References

Clone this wiki locally