// random_porter_thumbnails.txt
// by Thomas J. Spirock
// edited 02/03/01


// ############################################################################ //


// create and return a random number between 1 and "input"
function rand ( input )
{

  return Math.floor( Math.random ( ) * input ) + 1;

}

// ############################################################################ //

// the function "pad" will ensure that the input number has three characters.
//  input = 4, output = 004. 
function pad ( number, width )
{

  fill = "0";				// define the zero to add on the left
  n = String ( number );		// convert the input integer into a character
  while ( n.length < width )		// add zeros to the left of the number
  {

    n = fill + n;

  }

return ( n );				// return the number

}

// ############################################################################ //

// the number of thumbnails in the data set
max = 276;

// generate eleven random numbers
num1 = rand( max );
num2 = rand( max );
num3 = rand( max );
num4 = rand( max );
num5 = rand( max );
num6 = rand( max );
num7 = rand( max );
num8 = rand( max );
num9 = rand( max );
num10 = rand( max );
num11 = rand( max );

// check that the eleven random numbers are unique

while ( num2 == num1 )
{
  num2 = rand( max );
}

while ( num3 == num1 || num3 == num2 )
{
  num3 = rand( max );
}

while ( num4 == num1 || num4 == num2 || num4 == num3 )
{
  num4 = rand( max );
}

while ( num5 == num1 || num5 == num2 || num5 == num3 || num5 == num4 )
{
  num5 = rand( max );
}

while ( num6 == num1 || num6 == num2 || num6 == num3 || num6 == num4 || num6 == num5 )
{
  num6 = rand( max );
}

while ( num7 == num1 || num7 == num2 || num7 == num3 || num7 == num4 || num7 == num5 || num7 == num6 )
{
  num7 = rand( max );
}

while ( num8 == num1 || num8 == num2 || num8 == num3 || num8 == num4 || num8 == num5 || num8 == num6 || num8 == num7 )
{
  num8 = rand( max );
}

while ( num9 == num1 || num9 == num2 || num9 == num3 || num9 == num4 || num9 == num5 || num9 == num6 || num9 == num7 || num9 == num8 )
{
  num9 = rand( max );
}

while ( num10 == num1 || num10 == num2 || num10 == num3 || num10 == num4 || num10 == num5 || num10 == num6 || num10 == num7 || num10 == num8 || num10 == num9 )
{
  num10 = rand( max );
}

while ( num11 == num1 || num11 == num2 || num11 == num3 || num11 == num4 || num11 == num5 || num11 == num6 || num11 == num7 || num11 == num8 || num11 == num9 || num11 == num10 )
{
  num11 = rand( max );
}

// the number of characters in the random numbers
width = 3;

// make sure the random numbers are "width" characters
num1 = pad ( num1, width );
num2 = pad ( num2, width );
num3 = pad ( num3, width );
num4 = pad ( num4, width );
num5 = pad ( num5, width );
num6 = pad ( num6, width );
num7 = pad ( num7, width );
num8 = pad ( num8, width );
num9 = pad ( num9, width );
num10 = pad ( num10, width );
num11 = pad ( num11, width );

