I'm looking to set up a 5 x 5 matrix of images which I would like scrambled every time the page is loaded. I know how to create a random number in JavaScript and use that number to load a numbered gif, such as 1.gif 2.gif, etc. But how would I generate a random loading scheme which will exclude any of the random numbers I've already used? In other words, I have 25 images and I want them to load in random order, with equal chance to be in any position in the matrix and not always next to the same other images. Does anyone know how to do that with JavaScript?

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trialWhat I would really like is a pre-written script that generates a set of non-recurring integers, in my case from 1 to 25, in a scrambled order upon each trigger. I've given up at the point outlined below. (The image tags are for outline purposes, I'm really only stuck on the JavaScript.)

<!-- This document was created with HomeSite 2.5 -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>

<HEAD>

<TITLE>Bingo Test</TITLE>

</HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!--

var used = new Array()

if (used =

for(var i=1; i<=25;)

image01 = ('"+Math.ceil(Math.random(

image02 = ('"+Math.ceil(Math.random(

image03 = ('"+Math.ceil(Math.random(

image04 = ('"+Math.ceil(Math.random(

image05 = ('"+Math.ceil(Math.random(

image06 = ('"+Math.ceil(Math.random(

image07 = ('"+Math.ceil(Math.random(

image08 = ('"+Math.ceil(Math.random(

image09 = ('"+Math.ceil(Math.random(

image10 = ('"+Math.ceil(Math.random(

image11 = ('"+Math.ceil(Math.random(

image12 = ('"+Math.ceil(Math.random(

image13 = ('"+Math.ceil(Math.random(

image14= ('"+Math.ceil(Math.random(

image15 = ('"+Math.ceil(Math.random(

image16 = ('"+Math.ceil(Math.random(

image17 = ('"+Math.ceil(Math.random(

image18 = ('"+Math.ceil(Math.random(

image19 = ('"+Math.ceil(Math.random(

image20 = ('"+Math.ceil(Math.random(

image21= ('"+Math.ceil(Math.random(

image22 = ('"+Math.ceil(Math.random(

image23= ('"+Math.ceil(Math.random(

image24 = ('"+Math.ceil(Math.random(

image25 = ('"+Math.ceil(Math.random(

//-->

</SCRIPT>

<BODY>

<TABLE Border="1">

<TR>

<TD>image 1</TD>

<TD>image 2</TD>

<TD>image 3</TD>

<TD>image 4</TD>

<TD>image 5</TD>

</TR>

<TR>

<TD>image 6</TD>

<TD>image 7</TD>

<TD>image 8</TD>

<TD>image 9</TD>

<TD>image 10</TD>

</TR>

<TR>

<TD>image 11</TD>

<TD>image 12</TD>

<TD>image 13</TD>

<TD>image 14</TD>

<TD>image 15</TD>

</TR>

<TR>

<TD>image 16</TD>

<TD>image 17</TD>

<TD>image 18</TD>

<TD>image 19</TD>

<TD>image 20</TD>

</TR>

<TR>

<TD>image 21</TD>

<TD>image 22</TD>

<TD>image 23</TD>

<TD>image 24</TD>

<TD>image 25</TD>

</TR>

</TABLE>

</BODY>

</HTML>

JavaScript

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

You will end up with a double nested for loop with a if statement in it.