lundi 28 décembre 2020

How can I stop a script from shuffling the words (questions) every time I start the exercise?

I am an English teacher and I created an exercise, using Hotpotatoes, to demonstrate to my student how to make sentences from different words. The words are in alphabetical order so I can easily find the word I want to use.

But there is a code in the script that shuffles them every time I start or restart the html file. I have no experience in coding. I have been trying to change the two shuffle functions to make them stop from shuffling. Deleting them did not work, the whole exercise disappeared. By the way, the file is not a test; it's just me demonstrating to the kids over the Internet how to make sentences by dragging the words and putting them together.

The file was too big for here. Here are the two codes that I believe are doing the shuffling:

function Shuffle(InArray){
    var Num;
    var Temp = new Array();
    var Len = InArray.length;

    var j = Len;

    for (var i=0; i<Len; i++){`enter code here`
        Temp[i] = InArray[i];
    }

    for (i=0; i<Len; i++){
        Num = Math.floor(j  *  Math.random() *1);
        InArray[i] = Temp[Num];

        for (var k=Num; k < (j-1); k++) {
            Temp[k] = Temp[k+1];
        }
        j--;
    }
    return InArray;
}

Segments = Shuffle(Segments);



Aucun commentaire:

Enregistrer un commentaire