var r_count = 5;
var limages = new Array();
limages[0] = 'image_0.jpg';
limages[1] = 'image_1.jpg';
limages[2] = 'image_2.jpg';
limages[3] = 'image_3.jpg';
limages[4] = 'image_4.jpg';
limages[5] = 'image_5.jpg';
limages[6] = 'image_6.jpg';
limages[7] = 'image_7.jpg';
limages[8] = 'image_8.jpg';
limages[9] = 'image_9.jpg';
var d_count = limages.length - r_count
var j = 0;
while (j < d_count)
{
d = Math.floor(Math.random()*limages.length);
if (limages[d])
{
delete(limages[d]);
j++;
}
}
var s = '';
for( keyname in limages)
{
s += keyname + " : " + limages[keyname] + "<br>";
}
document.write(s);
Just a notice: images array starts from 0, not from 1 ...
EDIT: Ooops, a little mistake
EDIT2: When I started writing it I was hoping that delete() would remove the array element, but it appeared not to be so ...
There are 10 types of people in this world, those who understand binary and those who don't