Hi Guys,I'm doing some performance testing on a ImageService through AGS WMS and I'm trying to generate random extents. I've tried a very overly simplistic javascript to do this based on the max extent, however the images coming back get scewed, etc. This is not an ArcServer or ImageServer problem, but rather that my random number generator may be giving me back unrealistic extents. Is there a better method if, given a max extent, projection, image length, and image width, of generating USABLE extent values?My current code:/**
* Generates a random number that falls between a max and min value.
* @param minValue The minimum value.
* @param maxValue The maximum value.
* @param precision The floating-point precision value.
* @return A random float number between the min and max value.
*/
function randomFloatBetween(minValue,maxValue,precision){
if(typeof(precision) == 'undefined'){
precision = 2;
}
return parseFloat(Math.min(minValue + (Math.random() * (maxValue - minValue)),maxValue).toFixed(precision));
}
//set the maximum extent.
var ymin = parseFloat("43.893368");
var xmin = parseFloat("-76.201033");
var ymax = parseFloat("47.785260");
var xmax = parseFloat("-69.957141");
//generate 2 random x points.
var xvalue = randomFloatBetween(xmin, xmax, 6);
var xvalue2 = randomFloatBetween(xmin, xmax, 6);
//generate 2 random y points.
var yvalue = randomFloatBetween(ymin, ymax, 6);
var yvalue2 = randomFloatBetween(ymin, ymax, 6);
//set the NEW xmin, xmax, ymin, ymax values.
var minX = 0;
var minY = 0;
var maxX = 0;
var maxY = 0;
if(xvalue >= xvalue2) {
maxX = xvalue;
minX = xvalue2;
} else {
maxX = xvalue2;
minX = xvalue;
}
if(yvalue >= yvalue2) {
maxY = yvalue;
minY = yvalue2;
} else {
maxY = yvalue2;
minY = yvalue;
}
vars.put('bbox', minY+','+minX+','+maxY+','+maxX);
Bill