I want to generate a random order for the integers between 0 and 256^3 (to obtain randomly all the colors), so I'm using this way for now:
var c = [],
j = 0;
//enum
for (;j<16777216;j++) c[j] = j;
//calculate random elements faster
for(;c.length;c.splice(j,1)) {
j = Math.floor(Math.random() * c.length);
//every j is a random number between 0 and 256^3
}
It takes a long time to generate all the numbers...Do you know a way with better time performance to solve this?