randomValue (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Subhajit Sahu edited this page

May 3, 2023

·3 revisions

Pick an arbitrary value.

Similar: randomValue, values, hasValue, searchValue.

function randomValue(x, fr) // x: an array // fr: random number generator ([0, 1))

const xarray = require('extra-array');

var x = [1, 2, 3]; xarray.randomValue(x); // → 3

xarray.randomValue(x); // → 2

References

Clone this wiki locally