-
Notifications
You must be signed in to change notification settings - Fork 0
randomKey
Subhajit Sahu edited this page Dec 22, 2022
·
1 revision
Pick an arbitrary key.
function randomKey(x, fr)
// x: entries
// fr: random number generator ([0, 1))
const entries = require('extra-entries');
var x = [["a", 1], ["b", 2], ["c", 3]];
entries.randomKey(x);
// → "c"
entries.randomKey(x);
// → "b"