Does anyone know of a way to easily allow my slideshow image gallery (jpgs) to randomly play rather than in numbered sequence?
Thanks for anyone’s help!
Posted about 1 month ago
Array.prototype.randomize = function() {
var i = this.length;
if (i == 0) return;
while (—i) {
var j = Math.floor(Math.random()*(i+1));
var tmp1 = this[i];
var tmp2 = this[j];
this[i] = tmp2;
this[j] = tmp1;
}
return this;
}
//var arr = new Array(1,2,3,4,5,6,7,8,9);
//trace(arr.randomize());
Array.prototype.randomize = function() {
var i = this.length;
if (i == 0) return;
while (—i) {
var j = Math.floor(Math.random()*(i+1));
var tmp1 = this[i];
var tmp2 = this[j];
this[i] = tmp2;
this[j] = tmp1;
}
return this;
}
//var arr = new Array(1,2,3,4,5,6,7,8,9);
//trace(arr.randomize());
wow way to complicate the hell out of it bob just plain Math.random() works fine.
Posted about 1 month ago