
//function for unique Question
function populate(array1, array2, length) {

    while (array2.length < length) {
        var randomImageData = Math.floor(Math.random() * array1.length);
        if (array2.indexOf(randomImageData) == -1) {
            array2.push(randomImageData);
        }
    }
    return array2;
}


function shuffle(sarray) {

    var arrayLength = sarray.length;
    var temp, random_index;
    while (arrayLength > 0) {
        random_index = Math.floor(Math.random() * arrayLength);
        arrayLength--;
        temp = sarray[arrayLength];
        sarray[arrayLength] = sarray[random_index];
        sarray[random_index] = temp;
    }

    return (sarray);
}

function numberSplit(number) {
    var no_array = [], noOfDigit, numberWithCouma = "";

    number = number.toString();
    no_array = number.split("");
    noOfDigit = no_array.length;
    index = noOfDigit - 3;
    i = no_array.length - 1;

    while (index > 0) {
        no_array[index] = "," + no_array[index];
        index = index - 2;
    }
    for (i; i >= 0; i--) {
        numberWithCouma = no_array[i].concat(numberWithCouma);
    }
    return numberWithCouma

}

