Enables the sampling operation to be executed on an array based on the given element count.
npm i sondaj
<!DOCTYPE html>
<html>
<head>
<title>A sample app for sampling operation</title>
</head>
<body>
<script type="text/javascript" src="https://unpkg.com/sondaj@1.0.0/sondaj.js"></script>
</body>
</html>
var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var sampledArray = arr.sondajla(5);
console.log(sampledArray);
Or simply:
console.log([0, 1, 2, 3, 4, 5, 6, 7, 8, 9].sondajla(5));
Returns randomized subset of array based on samplingCount.
MIT