Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeffreymorganio/09305c0186509a6e05efe318983c2879 to your computer and use it in GitHub Desktop.
Save jeffreymorganio/09305c0186509a6e05efe318983c2879 to your computer and use it in GitHub Desktop.
Create and fill a JavaScript array with random values.
function randomDataSet(dataSetSize, minValue, maxValue) {
return new Array(dataSetSize).fill(0).map(function(n) {
return Math.random() * (maxValue - minValue) + minValue;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment