Skip to content

Instantly share code, notes, and snippets.

@huckfinnaafb
Created January 6, 2012 23:40
Show Gist options
  • Save huckfinnaafb/1573023 to your computer and use it in GitHub Desktop.
Save huckfinnaafb/1573023 to your computer and use it in GitHub Desktop.
function toIndice(vec, graph_width) {
return ((vec.y) * graph_width + vec.x);
}
function allUnique(array) {
var uniques = _.uniq(array);
return array.length === uniques.length;
};
var graph_width = 23;
var vectors = [];
var indices = [];
var i, vectors = [], indices = [];
for (i = 0; i < 5000; i += 1) {
vectors.push(new Vector(0, 0, 0));
}
var j;
for (j = 0; j < vectors.length; j += 1) {
vectors[j].y = j;
var k;
for (k = 0; k < graph_width; k+= 1) {
vectors[j].x = k;
indices.push(toIndice(vectors[j], graph_width));
}
k = 0;
}
console.log(allUnique(indices));
=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment