Skip to content

Instantly share code, notes, and snippets.

@adamabernathy
Created December 2, 2016 17:30
Show Gist options
  • Save adamabernathy/8cce9986f9e8259df937d3c3693f21fc to your computer and use it in GitHub Desktop.
Save adamabernathy/8cce9986f9e8259df937d3c3693f21fc to your computer and use it in GitHub Desktop.
Creates a linearly spaced array
/**
* Create a linearly spaced array
*
* @param {number} start - starting integer
* @param {number} nvalues - how many values
* @param {number} interval - interval (optional)
*/
function __linspace(start, nvalues, interval) {
if (typeof interval === "undefined") { interval = 0; }
var i;
var r = [];
for (i = 0; i < nvalues; i++) {
r.push(start + (i * interval));
}
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment