Shuffle the arrat and then grab as many as you need off the front.
Code:
Array.prototype.shuffle = function() {
var s = [];
while (this.length) s.push(this.splice(Math.random() * this.length, 1)[0]);
while (s.length) this.push(s.pop());
return this;
};
function random_imglink(){
var myimages = []
myimages[1] = "01.jpg"
myimages[2] = "02.jpg"
myimages[3] = "03.jpg"
myimages[4] = "04.jpg"
myimages[5] = "05.jpg"
...
myimages[31] = "31.jpg"
myimages.shuffle();
var rq = myimages[0];
var rr = myimages[1];
// ... etc