javascript generate random array
//This example is to generate an array with 40 random elements, with random values from 0 to 39
for (var a=[],i=0;i<40;++i) a[i]=i;
// http://stackoverflow.com/questions/962802#962890
function shuffle(array) {
var tmp, current, top = array.length;
if(top) while(--top) {
current = Math.floor(Math.random() * (top + 1));
tmp = array[current];
array[current] = array[top];
array[top] = tmp;
}
return array;
}
a = shuffle(a);
Also in JavaScript:
- simple node server
- run a function after delay javascript
- javascript hash string
- javascript map
- activar funcion js con id
- sum range javascript
- jquery preventdefault
- javascript get all options from select
- usematch react router
- read and save excel with react
- javascript example code
- javascript object array sum of values in object
- sequelize get where
- express get request origin
- get random reddit image link
- auto refresh page javascript
- delete node module
- react lifecycle
- loopback before save
- jquery cheat sheet
- simple express server
- jquery datepicker on multiple input fields
- vuejs use set to prevent duplicates
- Robux gift