# What is the action script for random pictures?

**URL:** <https://forum.kirupa.com/t/what-is-the-action-script-for-random-pictures/102475>\
**Category:** Uncategorized\
**Created:** [February 24, 2004, 6:13am UTC](https://forum.kirupa.com/t/what-is-the-action-script-for-random-pictures/102475 "2004-02-24T06:13:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![whitetulips](https://avatars.discourse-cdn.com/v4/letter/w/ba9def/32.png) [@whitetulips](https://forum.kirupa.com/u/whitetulips)\
**Post date:** [February 24, 2004, 6:13am UTC](https://forum.kirupa.com/t/what-is-the-action-script-for-random-pictures/102475/1 "2004-02-24T06:13:37Z")

</div>

wat is the action script if:

I have 16 different pictures that are suppose to appear randomly (10 at a time) when the page loads.

which means each time the page load, there will be 10 pictures in it, without repetition.

pls help… tq (-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 24, 2004, 9:31am UTC](https://forum.kirupa.com/t/what-is-the-action-script-for-random-pictures/102475/2 "2004-02-24T09:31:34Z")

</div>

[http://www.kirupa.com/developer/mx/loadingrandombackground.htm](http://www.kirupa.com/developer/mx/loadingrandombackground.htm)

perhaps this will help;)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 24, 2004, 9:47am UTC](https://forum.kirupa.com/t/what-is-the-action-script-for-random-pictures/102475/3 "2004-02-24T09:47:48Z")

</div>

```auto
pictures_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
Array.prototype.pickRandomValues = function(n) {
	var selected = [];
	for (var i = 0; i<n; ++i) {
		var r = Math.floor(Math.random()*this.length);
		selected.push(this[r]);
		this.splice(r, 1);
	}
	return selected;
};
//this will return 10 random values out of the pictures_array
trace(pictures_array.pickRandomValues(10));

```
