function randomBrowserSizes(sizeRange, iterationAmount) {
    var sizes       = [],
        sizeStart   = parseSize(sizeRange[0]),
        sizeEnd     = parseSize(sizeRange[1]),
        deltaWidth  = sizeEnd.width - sizeStart.width,
        deltaHeight = sizeEnd.height - sizeStart.height,
        maxDistance = Math.max(Math.abs(deltaWidth), Math.abs(deltaHeight));

    if (iterationAmount < 1) {
        throw new Error("Amount of iterations should be greater than 0");
    }
    if (iterationAmount > maxDistance) {
        iterationAmount = maxDistance;
    }


    for (var i = 0; i < iterationAmount; i += 1) {
        var widthStart = Math.floor(sizeStart.width + deltaWidth * i / iterationAmount);
        var widthEnd = Math.floor(sizeStart.width + deltaWidth * (i + 1) / iterationAmount);

        var heightStart = Math.floor(sizeStart.height + deltaHeight * i / iterationAmount);
        var heightEnd = Math.floor(sizeStart.height + deltaHeight * (i + 1) / iterationAmount);

        var w = randomIntValueFromRange(widthStart, widthEnd);
        var h = randomIntValueFromRange(widthStart, widthEnd);
        sizes.push(w + "x" + h);
    }

    return sizes;
}
/**
 * Generates randomized variations of screen sizes and returns an array
 */
Generates randomized variations of screen sizes and returns an array
Generates randomized variations of screen sizes and returns an array
function randomBrowserSizes(sizeRange, iterationAmount) {
    var sizes       = [],
        sizeStart   = parseSize(sizeRange[0]),
        sizeEnd     = parseSize(sizeRange[1]),
        deltaWidth  = sizeEnd.width - sizeStart.width,
        deltaHeight = sizeEnd.height - sizeStart.height,
        maxDistance = Math.max(Math.abs(deltaWidth), Math.abs(deltaHeight));
    if (iterationAmount < 1) {
        throw new Error("Amount of iterations should be greater than 0");
    }
    if (iterationAmount > maxDistance) {
        iterationAmount = maxDistance;
    }
    for (var i = 0; i < iterationAmount; i += 1) {
        var widthStart = Math.floor(sizeStart.width + deltaWidth * i / iterationAmount);
        var widthEnd = Math.floor(sizeStart.width + deltaWidth * (i + 1) / iterationAmount);
        var heightStart = Math.floor(sizeStart.height + deltaHeight * i / iterationAmount);
        var heightEnd = Math.floor(sizeStart.height + deltaHeight * (i + 1) / iterationAmount);
        var w = randomIntValueFromRange(widthStart, widthEnd);
        var h = randomIntValueFromRange(widthStart, widthEnd);
        sizes.push(w + "x" + h);
    }
    return sizes;
}
function randomBrowserSizes ( sizeRange , iterationAmount ) { var sizes = [ ] , sizeStart = parseSize ( sizeRange [ 0 ] ) , sizeEnd = parseSize ( sizeRange [ 1 ] ) , deltaWidth = sizeEnd . width - sizeStart . width , deltaHeight = sizeEnd . height - sizeStart . height , maxDistance = Math . max ( Math . abs ( deltaWidth ) , Math . abs ( deltaHeight ) ) ; if ( iterationAmount < 1 ) { throw new Error ( "Amount of iterations should be greater than 0" ) ; } if ( iterationAmount > maxDistance ) { iterationAmount = maxDistance ; } for ( var i = 0 ; i < iterationAmount ; i += 1 ) { var widthStart = Math . floor ( sizeStart . width + deltaWidth * i / iterationAmount ) ; var widthEnd = Math . floor ( sizeStart . width + deltaWidth * ( i + 1 ) / iterationAmount ) ; var heightStart = Math . floor ( sizeStart . height + deltaHeight * i / iterationAmount ) ; var heightEnd = Math . floor ( sizeStart . height + deltaHeight * ( i + 1 ) / iterationAmount ) ; var w = randomIntValueFromRange ( widthStart , widthEnd ) ; var h = randomIntValueFromRange ( widthStart , widthEnd ) ; sizes . push ( w + "x" + h ) ; } return sizes ; }
Generates randomized variations of screen sizes and returns an array
Generates randomized variations of screen sizes and returns an array