https://play.google.com/store/apps/details?id=com.bimasoft.le
Wednesday, November 2, 2016
javascript suffle
function shuffle(array) {
var m = array.length, t, i;
while (m) {
i = Math.floor(Math.random() * m--);
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
// test call
var letter= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
var random = shuffle(letter.slice());
console.log(random)
console.log(letter)
shuffle(letter)
console.log(letter)
javascript random array
function randcol() {
var ac =["red","orange","yellow","green","blue","purple","brown","pink","magenta","cyan","olive","maroon","navy","aquamarine","turquoise","silver","lime","teal","indigo","violet"]
return ac[Math.floor(Math.random() * ac.length)]
}
//test call
console.log( randcol())
var ac =["red","orange","yellow","green","blue","purple","brown","pink","magenta","cyan","olive","maroon","navy","aquamarine","turquoise","silver","lime","teal","indigo","violet"]
return ac[Math.floor(Math.random() * ac.length)]
}
//test call
console.log( randcol())
Subscribe to:
Posts (Atom)